Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push notifications not asking permission when user loads app

Hi I have just released my app update with push notifications added into it. I was worried that it would not work properly so I did a bunch of testing. First with just a development certificate and then a production certificate using adhoc. Both ended up working and I was pleased when the adhoc worked.

Anyways the update has been live for about 8 hours now and for some reason push isn't working. I checked with my friend and have realized that the user is not being asked whether he wants to accept push notifications from my app. Which means when the token gets sent to my server, its appearing as (null). I have no idea why this is happening. When he goes into device settings --> notifications ---> my app does not appear on any of the lists (receiving push notifications or not receiving).

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

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

If anyone knows why this is happening, input would be much appreciated. Thanks!

like image 480
Alex G Avatar asked Dec 01 '22 05:12

Alex G


2 Answers

We thought we were having this same issue but found out that the app was actually working correctly. The user is only prompted once even if they uninstall and reinstall the app.

We were testing it by uninstalling the app and then reinstalling. iOS would remember how we had responded previously on that device and would not prompt again leading us to think there was a problem.

We found the best way to test is with the simulator and doing a "Reset Content and Settings".

like image 96
respectTheCode Avatar answered Dec 04 '22 05:12

respectTheCode


After configuring your app for push notifications and generating your SSL certificates you must also generate new provisioning profiles.

The developer portal displays this message on the App ID configuration page:

After you have generated your Client SSL certificate, create a new provisioning profile containing the App ID you wish to use for notifications.

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

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

like image 24
Heiberg Avatar answered Dec 04 '22 07:12

Heiberg