Created
July 25, 2009 20:33
-
-
Save markbates/154957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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
minor thing: you're leaking the device in the second method. No?
In general -- thanks for the great work on Objective Resource!