Skip to content

Instantly share code, notes, and snippets.

@dewski
Forked from markbates/gist:154957
Created September 10, 2009 02:25
Show Gist options
  • Save dewski/184249 to your computer and use it in GitHub Desktop.
Save dewski/184249 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