Skip to content

Commit

Permalink
Updated to iOS 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
duccio committed Apr 4, 2016
1 parent 38ed486 commit f1e1930
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions Objective-C Demo/Classes/DemoAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[window makeKeyAndVisible];

#if !TARGET_IPHONE_SIMULATOR
[application registerForRemoteNotificationTypes:
UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound) categories:nil]];
[application registerForRemoteNotifications];
#endif

application.applicationIconBadgeNumber = 0;
Expand All @@ -53,14 +53,18 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N

if (application.applicationState == UIApplicationStateActive) {
// Nothing to do if applicationState is Inactive, the iOS already displayed an alert view.
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Did receive a Remote Notification"
message:[NSString stringWithFormat:@"The application received this remote notification while it was running:\n%@",
[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
[alertView release];

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Did receive a Remote Notification"
message:[NSString stringWithFormat:@"The application received this remote notification while it was running:\n%@", [[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[alertController dismissViewControllerAnimated:YES completion:nil];
}];

[alertController addAction:alertAction];
[self.viewController presentViewController:alertController animated:YES completion:nil];
}
}

Expand All @@ -84,9 +88,9 @@ - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotif
#pragma mark Memory management

- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
[viewController release];
[window release];
[super dealloc];
}

@end

0 comments on commit f1e1930

Please sign in to comment.