// registe remote notification-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{// Let the device know we want to receive push notifications[[UIApplicationsharedApplication]registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert)];// other codereturnYES;}#pragma mark -#pragma mark APN-(void)application:(UIApplication*)applicationdidRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{NSLog(@"My token is: %@",deviceToken);// send token to server}-(void)application:(UIApplication*)applicationdidFailToRegisterForRemoteNotificationsWithError:(NSError*)error{NSLog(@"Failed to get token, error: %@",error);}-(void)application:(UIApplication*)applicationdidReceiveRemoteNotification:(NSDictionary*)userInfo{NSLog(@"收到推送: %@",userInfo);if([[userInfoobjectForKey:@"aps"]objectForKey:@"alert"]!=NULL){UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:@"推送通知"message:[[userInfoobjectForKey:@"aps"]objectForKey:@"alert"]delegate:selfcancelButtonTitle:@"关闭"otherButtonTitles:@"更新状态",nil];[alertshow];[alertrelease];}}