Push notifications do not request permission when a user loads

Hi, I just released an update to my application with the addition of push notifications. I was worried that it would not work properly, so I checked a lot of tests. First you need only a development certificate, and then a production certificate using adhoc. Both finished work, and I was pleased when adhoc worked.

In any case, the update lasted about 8 hours, and for some reason the push did not work. I checked with my friend and realized that the user was not asked if he wants to receive push notifications from my application. This means that the token is sent to my server and it appears as (null). I have no idea why this is happening. When it goes into the device settings β†’ notifications ---> my application does not appear in any of the lists (receiving push notifications or not receiving).

This is the code of my delegate that should trigger the request:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; 

If anyone knows why this is happening, entry will be greatly appreciated. Thanks!

+4
source share
2 answers

After setting up your application for push notifications and creating your SSL certificates, you must also generate new provisioning profiles.

The developer portal displays this message on the application identifier configuration page:

After you have created the client SSL certificate, create a new provisioning profile that contains the application identifier that you want to use for notifications.

If you did not update the App Store provisioning profile after setting up push, OS will not provide you a token.

If this is your problem, you just need to create a new App Store distribution profile and send a recompiled version signed with that profile.

+8
source

We thought that we had the same problem, but found out that the application really works correctly. The user is requested only once, even if they uninstall and reinstall the application.

We tested it by uninstalling the application and reinstalling it. iOS will remember how we answered earlier on this device and do not prompt again so that we think that there is a problem.

We found that the best way to test is by using a simulator and creating "Reset content and settings."

+11
source

Source: https://habr.com/ru/post/1415523/


All Articles