我終於從UrbanAhiphip推送了推送通知。但現在我遇到了一個問題,在這裏搜索並找不到解決方案。UrbanAirship iOS推送通知錯誤
當應用程序正在運行並收到通知時,單擊通知會將我帶入應用程序,並且一切正常。
當我殺了應用程序並收到通知時,該應用程序將與SIGKILL一起死亡。
這裏是日誌:log
OK,這是我的appdelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Init Airship launch options
NSLog(@"Before NSMutableDictionary");
NSMutableDictionary *takeOffOptions = [[NSMutableDictionary alloc] init];
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];
// Create Airship singleton that's used to talk to Urban Airship servers.
// Please populate AirshipConfig.plist with your info from http://go.urbanairship.com
NSLog(@"Before takeOff");
[UAirship takeOff:takeOffOptions];
// Register for notifications
NSLog(@"Before UIApplication");
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
NSLog(@"Before reset badge");
//reset badge
application.applicationIconBadgeNumber = 0;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSLog(@"didRegisterForRemoteNotifications");
[[UAirship shared] registerDeviceToken:deviceToken];
}
-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSString *str = [NSString stringWithFormat: @"Error: %@", error];
NSLog(@"Error:%@",str);
}
這個Mac Mini的前不勝感激任何幫助穿過窗口:-)
此外:似乎這隻發生在設備連接到Mac ....這是正常的行爲? – Tony