Skip to content

Instantly share code, notes, and snippets.

@Hokila
Created April 21, 2013 14:01
Show Gist options
  • Save Hokila/5429681 to your computer and use it in GitHub Desktop.
Save Hokila/5429681 to your computer and use it in GitHub Desktop.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
NSString *token = [NSString stringWithFormat:@"%@", [deviceToken description]];
token = [token stringByReplacingOccurrencesOfString:@"<" withString:@""];//去左箭號
token = [token stringByReplacingOccurrencesOfString:@">" withString:@""];//去右鍵號
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];//去空白
//把拿到的deviceToken去頭去尾後 拿去註冊push
[self registerPushServer:self.phone_id :token ];
//把BadgeNumber設為0
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
[Flurry logError:@"推播註冊失敗" message:@"APNS無回應" error:error];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment