Reputation: 785
The same source code works fine i Xcode 7.3.1, but when I compile with Xcode 8.1, then I never receive any push notifications
YES, I have enabled the Settings->Targets->Capabilities->PushNotifications.
And, YES, these two methods are are called: didRegisterUserNotificationSettings didRegisterForRemoteNotificationsWithDeviceToken
I am testing on device iPhone 6S, iOS 10.1.1 I have cleaned the build
I tried some suggested solutions from stackoverflow, suggesting using UNUserNotificationCenter, but of no help.
What could possibly be wrong?
Upvotes: 1
Views: 384
Reputation: 449
You can use below two delegate for iOS10 with this delegate name UNUserNotificationCenterDelegate
For Swift:
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (_ options: UNNotificationPresentationOptions) -> Void) {
print("\(notification.request.content.userInfo)")}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
print("\(response.notification.request.content.userInfo)")}
Upvotes: 1