은 AppDelegate에 다음 코드로 처리 푸시 알림을 구문 분석 :iOS 버전에 따라 푸시 알림을 처리하는 방법은 무엇입니까? iOS7에 대한
[application registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge|
UIRemoteNotificationTypeAlert|
UIRemoteNotificationTypeSound];
registerForRemoteNotificationTypes
그러나 iOS8의에서 지원되지 않습니다, 지금 iOS8의에서 푸시 알림을 처리하는 데 사용되는 새로운 코드는 다음과 같습니다
UIUserNotificationSettings *settings =
[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound
categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
이 새로운 코드를 iOS7 장치와 함께 사용하면 앱이 충돌을 일으켜 코드가 어떤 버전의 휴대 전화인지 확인하고 적절한 푸시 알림 코드를 실행해야합니다. 앱에서이를 확인하고 올바른 것을 사용하려면 어떻게해야합니까?
가능한 [registerForRemoteNotificationTypes : iOS 8.0 이상에서는 지원되지 않습니다.] (http://stackoverflow.com/questions/24454033/registerforremotenotificationtypes-is-not-supported-in-ios-8-0-and-later) –