- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after app launch
//최초 엑세스 인가?
self.isFirstTimeAccess = TRUE;
//APNS 에 장치 등록
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
//Badge 개수 설수
application.applicationIconBadgeNumber = 0;
}
//push : APNS 에 장치 등록 성공시 자동실행
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
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];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:string delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
//push : APNS 에 장치 등록 오류시 자동실행
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"deviceToken error : %@", error);
}
'개발도구 > iOS - 아이폰 개발' 카테고리의 다른 글
[아이폰] 아이폰 바탕화면에 wifi, bluetooth 버튼을 넣자 (0) | 2012.03.05 |
---|---|
[아이폰] PHP코드로 - 아이폰 PUSH 보내기 총정리 (1) | 2012.03.02 |
[아이폰] 푸시 - Local Notifications and Push Notifications (0) | 2012.02.29 |
[아이폰] push error - Domain=NSCocoaErrorDomain Code=3000 (0) | 2012.02.29 |
[아이폰] Developer/usr/bin/clang failed with exit code 1 error (0) | 2012.02.28 |