iPad didn't call didRegisterForRemoteNotificat

2019-08-14 17:38发布

问题:

I'm trying to get device token in iPad for remote push notifications; registerForRemoteNotificationTypes is called okay, no error, but didRegisterForRemoteNotificationsWithDeviceToken also not been called; Application is appear in Settings/Notification; What's I doing wrong?

iPhone is registering successfully.

Thank you

PS: iPad 1, iOs 5.1

回答1:

In this case, if the code works on iPhone that code should work on iPad as well. Coz the os is same. Anyway if your code is not working on iPad try to remove provisioning profile from the iPad and reinstall the correct one. Sometime the old provisioning profile remains. And don't forget to check the code signing on target as well.



回答2:

check that you are registering correctly for Push Notifications, including verifying your provisioning profile for "aps-environment" key and the code signing of the .app.

also you can debug Push Notification status messages in the console (you will need to install PersistentConnectionLogging.mobileconfig provisioning profile on your device and reboot it. check out this link under "Observing Push Status Messages").



回答3:

There is an important thing to know with the provisioning profile. You should ensure to create the certificate first (the one used for the notifications), and then recreate the provisioning profiles, so that they know about the notifications. So you're sure it's not a provisioning profile issue.



回答4:

Well, problem was solved in production sign and provisioning, but not in development. When I archive application for device and load it through iTunes, push notifications is working. Very strange behaviour.



回答5:

I know it's a late answer, but it may help others. I had the same issue as the OP. After you click ok on the notification popup, it disappears but none of the method gets called to get the device token. Then I checked the internet connection when testing push notifications and I realized I had no connection. After re-connecting, it began working fine.