iPhone城市飞艇坠毁瞬间事件
所以,我遵循UA文档,一切都很顺利。问题是我一直在下面了解这个崩溃iPhone城市飞艇坠毁瞬间事件,iphone,ios,notifications,push,urbanairship.com,Iphone,Ios,Notifications,Push,Urbanairship.com,所以,我遵循UA文档,一切都很顺利。问题是我一直在下面了解这个崩溃 Terminating app due to uncaught exception 'InstanceNotExists', reason: 'Attempted to access instance before initializaion. Please call takeOff: first.' 只有打开应用程序关闭应用程序,然后尝试重新打开,或者打开应用程序关闭应用程序,发送通知,然后尝试单击通知,才会出现这种情况。它
Terminating app due to uncaught exception 'InstanceNotExists', reason: 'Attempted to access instance before initializaion. Please call takeOff: first.'
只有打开应用程序关闭应用程序,然后尝试重新打开,或者打开应用程序关闭应用程序,发送通知,然后尝试单击通知,才会出现这种情况。它在第一次加载时从不崩溃。我在下面安装的代码
#import "UAirship.h"
#import "UAPush.h"
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSMutableDictionary *takeOffOptions = [NSMutableDictionary dictionary];
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];
[UAirship takeOff:takeOffOptions];
// Register for notifications
[[UAPush shared]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
//Updates the device token and registers the token with UA.
NSLog(@"My token is: %@", deviceToken);
[[UAPush shared] registerDeviceToken:deviceToken];
}
-(void)applicationWillTerminate:(UIApplication *)application
{
// Saves changes in the application's managed object context before the application terminates.
[UAirship land];
[self saveContext];
}
我错过什么了吗?任何帮助都将不胜感激!谢谢