if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[_locationManager requestWhenInUseAuthorization ];
}
[_locationManager startUpdatingLocation]; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[app registerForRemoteNotifications];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
UIRemoteNotificationTypeAlert
| UIRemoteNotificationTypeBadge
| UIRemoteNotificationTypeSound categories:nil];
[app registerUserNotificationSettings:settings];
} else {
[app registerForRemoteNotificationTypes:
UIRemoteNotificationTypeAlert
| UIRemoteNotificationTypeBadge
| UIRemoteNotificationTypeSound];
}原文:http://blog.csdn.net/iitvip/article/details/39477709