[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{ NSLog(@"My token is: %@", deviceToken); NSString *devID= [[NSString alloc]initWithFormat:@"%@", deviceToken]; [g_soap SetDeviceId:devID]; }- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error{ NSLog(@"Failed to get token, error: %@", error);}//处理收到的消息推送- (void)application:(UIApplication *)applicationdidReceiveRemoteNotification:(NSDictionary *)userInfo{ NSLog(@"Receive remote notification : %@",userInfo); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:[[NSString alloc]initWithFormat:@"%@",userInfo] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; [alert release];}