6

After the installing the new update of iOS 10, push notifications are not working, while the same implementation of code is working for iOS 9. Is there any new thing for iOS 10 for push notification. As, I am not able figure it out. Also, is it necessary to turn on push notification under capabilities.

Sanchit Kumar Singh
  • 513
  • 1
  • 5
  • 17
  • have you try anything to find why it is not working ? hows you have implement it? are you getting any error or warning ? – Ketan Parmar Sep 14 '16 at 11:24
  • 2
    see this http://stackoverflow.com/questions/39382852/didreceiveremotenotification-not-being-called-when-i-tap-on-notification-on-ios/39383027#39383027 – Anbu.Karthik Sep 14 '16 at 11:26
  • 1
    @Anbu.Karthik I have seen that post, in that case he received the notification but didReceiveNotification was not called, while in my case I didn't received the notification only. – Sanchit Kumar Singh Sep 14 '16 at 11:39
  • then check your php code is production or sandbox mode – Anbu.Karthik Sep 14 '16 at 11:40
  • I am verifying everything on my side again, just wanted to know if apple has not changed the implementation part for sending push on iOS 10. – Sanchit Kumar Singh Sep 14 '16 at 11:42
  • 1
    I think its not a matter of sandbox or production environment the app should responds to the notification methods in appdelegate .. – vaibhav Sep 14 '16 at 11:58
  • 1
    Possible duplicate of [Handling user notifications on iOS 10](http://stackoverflow.com/questions/38940193/handling-user-notifications-on-ios-10) – Bhadresh Kathiriya Sep 29 '16 at 11:50

3 Answers3

10

Need some changes for iOS 10 with xCode 8 GM You need to implement UserNotification.framework and their delegate methods to get work of push notifications and in capabilities needs to enable Push Notifications.

You have to import new UserNotification.framework. Please follow this link : Push notification issue with iOS 10

Community
  • 1
  • 1
Ashish Shah
  • 2,361
  • 1
  • 20
  • 20
  • 1
    Thanks for the link, enabling push notifications under capabilities was helpful. Previously it worked for iOS 9 and below, without doing any change under capabilities. Although I am not clear why we are doing it in case of iOS 10. – Sanchit Kumar Singh Sep 15 '16 at 11:35
  • 1
    Without enabling Push Notifications in capabilities, I was getting email from apple to developer account : Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. So I worked around it and find this in capabilities. – Ashish Shah Sep 15 '16 at 12:52
  • 1
    Okay, So push were working without enabling push notification in capabilities?? And do you add anything in entitlements or in .plist – Sanchit Kumar Singh Sep 15 '16 at 23:17
  • so if we enable push notifications in capabilitities , is extra code for registering for ios 10 notifications not required in app delegate as mentioned in answer? – jayant rawat Oct 25 '16 at 11:32
  • 1
    @AshishShah No need to implement `UserNotification`. It can still be done with `UIUserNotificationSettings`. You just need to enable the capabilities for Push notifications which will make a .entitlement file in your project. – Rajan Maheshwari Nov 24 '16 at 06:18
2

Enabling the push notifications capabilities were not required as part of Xcode 7. This is now required in Xcode 8. By enabling push notifications capabilities in Xcode 8, it'll add the following changes:

project.pbxproj

com.apple.Push = {
    enabled = 1;
};

*.entitlements (for development)

<key>aps-environment</key>
<string>*development*</string>

*.entitlements (for enterprise and production)

<key>aps-environment</key>
<string>*production*</string>
Jen C
  • 460
  • 5
  • 14
  • except for `com.apple.Push = { enabled = 1; };` are there other lines in project.pbxproj that are necessary for remote notifications ? and thanks :D @Jen C – Skander Fathallah Dec 05 '18 at 15:52
1

On iOS 10 is necessary add the Push Notifications entitlement, so if you "Fix Issue" the problem will be resolved automatically.

Problem

raul
  • 101
  • 2
  • 7