×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Objective-C
Posted by: Black Light
Added: Mar 3, 2013 12:33 PM
Views: 23
Tags: no tags
methods for registering, getting device token, receiving remote notifications
  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  2. {
  3. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];
  4.    
  5.     return YES;
  6. }
  7.  
  8. - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceT
  9. {
  10.     NSString *deviceToken = [[[[deviceT description] stringByReplacingOccurrencesOfString:@"\<"withString:@""]
  11.                                                 stringByReplacingOccurrencesOfString:@"\>" withString:@""]
  12.                                            stringByReplacingOccurrencesOfString: @" " withString: @""];
  13. }
  14.  
  15. - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
  16. {
  17.         NSLog(@"Failed to get token, error: %@", error);
  18. }
  19.  
  20. - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
  21. {
  22.    
  23. }
  24.