Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone城市飞艇坠毁瞬间事件_Iphone_Ios_Notifications_Push_Urbanairship.com - Fatal编程技术网

iPhone城市飞艇坠毁瞬间事件

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.' 只有打开应用程序关闭应用程序,然后尝试重新打开,或者打开应用程序关闭应用程序,发送通知,然后尝试单击通知,才会出现这种情况。它

所以,我遵循UA文档,一切都很顺利。问题是我一直在下面了解这个崩溃

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];
}

我错过什么了吗?任何帮助都将不胜感激!谢谢