daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  PushTestAppDelegate.m
  3. //  PushTest
  4. //
  5. //  Created by Koushik Dutta on 9/12/11.
  6. //  Copyright 2011 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import "PushTestAppDelegate.h"
  10.  
  11. #import "PushTestViewController.h"
  12.  
  13. @implementation PushTestAppDelegate
  14.  
  15. @synthesize window = _window;
  16. @synthesize viewController = _viewController;
  17.  
  18. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  19. {
  20.     // Override point for customization after application launch.
  21.    
  22.     self.window.rootViewController = self.viewController;
  23.     [self.window makeKeyAndVisible];
  24.    
  25.     // Let the device know we want to receive push notifications
  26.     [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
  27.    
  28.     return YES;
  29. }
  30.  
  31. - (void)applicationWillResignActive:(UIApplication *)application
  32. {
  33.     /*
  34.      Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  35.      Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
  36.      */
  37. }
  38.  
  39. - (void)applicationDidEnterBackground:(UIApplication *)application
  40. {
  41.     /*
  42.      Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  43.      If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  44.      */
  45. }
  46.  
  47. - (void)applicationWillEnterForeground:(UIApplication *)application
  48. {
  49.     /*
  50.      Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
  51.      */
  52. }
  53.  
  54. - (void)applicationDidBecomeActive:(UIApplication *)application
  55. {
  56.     /*
  57.      Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  58.      */
  59. }
  60.  
  61. - (void)applicationWillTerminate:(UIApplication *)application
  62. {
  63.     /*
  64.      Called when the application is about to terminate.
  65.      Save data if appropriate.
  66.      See also applicationDidEnterBackground:.
  67.      */
  68. }
  69.  
  70. - (void)dealloc
  71. {
  72.     [_window release];
  73.     [_viewController release];
  74.     [super dealloc];
  75. }
  76.  
  77. - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
  78. {
  79.     NSLog(@"My token is: %@", deviceToken);
  80. }
  81.  
  82. - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
  83. {
  84.     NSLog(@"Failed to get token, error: %@", error);
  85. }
  86.  
  87. - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
  88. {
  89.     NSLog(@"Received notification: %@", userInfo);
  90.     //[self addMessageFromRemoteNotification:userInfo updateUI:YES];
  91. }
  92.  
  93. @end
RAW Paste Data
Top