Reputation: 2425
I've finally got push notifications working from UrbanAirship. But now I have a problem, searched here and can't find a solution.
When the app is running and I get a notification, clicking the notification takes me into the app and all is well.
When I kill the app and I get a notification, the app dies with SIGKILL.
Here is the log: log
OK, here is my 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);
}
Any help greatly appreciated before this Mac Mini goes through the window :-)
Upvotes: 1
Views: 619
Reputation: 51
You did mention that...
When I kill the app and I get a notification, the app dies with SIGKILL.
I'd check your applicationDidBecomeActive:(UIApplication *)application method. Apple docs says that...
This method is called to let your app know that it moved from the inactive to active state. This can occur because your app was launched by the user or the system. Apps can also return to the active state if the user chooses to ignore an interruption (such as an incoming phone call or SMS message) that sent the app temporarily to the inactive state.
You should use this method to restart any tasks that were paused (or not yet started) while the app was inactive. For example, you could use it to restart timers or throttle up OpenGL ES frame rates. If your app was previously in the background, you could also use it to refresh your app’s user interface.
Upvotes: 0
Reputation: 562
This has nothing to do with Urban Airship I don't think. If you:
You will get the same error message.
Since it happens in a brand new project without even touching it, I assume this behaviour is expected.
Upvotes: 1