2017-08-21 11 views
0

iOS 10をターゲットにアップグレードする際に、一部のコードが壊れています。解決策が見つからないため、次のように変換できます。目的C iOS 8で推奨されていないコード

- (void)userRequestsPushNotificationsOn { 
UIApplication *application = [UIApplication sharedApplication]; 
UIUserNotificationType notificationTypes = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; 
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; 
[application registerUserNotificationSettings:settings]; 
[application registerForRemoteNotifications]; 
} 

UIUserNotificationType & UIUserNotificationSettingsは推奨されません。

多くの方々、ありがとうございます!

+0

https://stackoverflow.com/questions/39782776/uiusernotificationtype-was-deprecated-in-ios10-swift-3-0を(それは、スウィフトにありますObjective-Cで何を使うべきかを知ることは理解できるはずです) – Larme

答えて

0

実装する必要があるものは、現在UNUserNotificationCenterです。

はここで自分でセットアップ得るための良いガイドです: Push Notifications in iOS 10

関連する問題