Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Forked from markbates/gist:154957
Created July 26, 2009 23:15
Show Gist options
  • Save jerodsanto/155974 to your computer and use it in GitHub Desktop.
Save jerodsanto/155974 to your computer and use it in GitHub Desktop.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
// Delegation methods
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
Device *device = [[Device alloc] init];
device.token = [devToken description];
[device saveRemote];
if ([device getRemoteId] != nil) {
NSLog(@"success!");
}
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
NSLog(@"Error in registration. Error: %@", err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment