Skip to content

Instantly share code, notes, and snippets.

@jinto
Created January 3, 2012 11:55
Show Gist options
  • Save jinto/1554641 to your computer and use it in GitHub Desktop.
Save jinto/1554641 to your computer and use it in GitHub Desktop.
자자자... 노티 노티
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSLog(@"start ---- jinto");
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[_7P3USZ44YViewController alloc] initWithNibName:@"_7P3USZ44YViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
NSLog(@"call register");
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
NSLog(@"call register end");
return YES;
}
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSLog(@"jinto -- token");
NSMutableString *deviceId = [NSMutableString string];
const unsigned char* ptr = (const unsigned char*) [deviceToken bytes];
for(int i = 0 ; i < 32 ; i++)
{
[deviceId appendFormat:@"%02x", ptr[i]];
}
NSLog(@"APNS Device Token: %@", deviceId);
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSString *string = [NSString stringWithFormat:@"%@", userInfo];
//NSString *text = [dict objectForKey:@"text"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:string delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
// [alert release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment