How do I check if an iOS distribution provisioning profile has push notifications enabled?

14,057

Solution 1

Ok, I may have found a way to verify whether or not the profiles have push enabled.

If I open the .mobileprovision file as a text file, there is a bit of XML there (a plist apparently) which I'm guessing for a distribution profile should have this:

<key>aps-environment</key>
<string>production</string>

And indeed, the adhoc profile had this and the distribution profile didn't, so... I'm guessing this was the problem.

Still, any feedback would be helpful :)

Solution 2

Slightly different, but still useful: when you upload an app to iTunes connect, you can check whether it has Push notifications (or any other entitlements) enabled.

To do this, go to Manage your Applications, select the application, then go to "View Details" for the version you want to check.

From there, go to the "Binary details" page - there's an Entitlements field that shows what the entitlements the binary has. If Push Notifications are enabled, you'll see a "aps-environment: production" line in there.

Share:
14,057
André Morujão
Author by

André Morujão

Software Engineer from Porto, Portugal

Updated on June 07, 2022

Comments

  • André Morujão
    André Morujão almost 2 years

    I have an app which was supposed to have push notifications enabled, but for some reason doesn't have them. I've seen other people download and install the app, and it doesn't even prompt them for permission to send push notifications. As expected, this app doesn't appear in their Settings > Notifications.

    However, on my iPad, I am able to receive push notifications from this app, and it does show up on my Settings > Notifications. I have deleted and reinstalled the app to make sure I had the same thing everyone else has (and not a development version), and I'm still able to get notifications.

    Now, this app was written for a client who sent me all the provisioning profiles (dev, adhoc, distribution) as well as the files needed to be able to send push notifications, so I can't know for sure that everything was properly created.

    My theory right now is that:

    • the adhoc profile I received was "properly created" (i.e. generated after setting up APNs on the app's App ID in the Provisioning Portal)
    • the distribution profile I received was generated before setting up APNs for this app (and thus, it's not "push enabled")
    • the reason I'm able to receive push notifications on my device is because during development I installed an adhoc version, which prompted me for permissions to receive push notifications, and even though I've deleted this adhoc version and downloaded the version from the store, the device has "cached" the fact that I'm willing to receive notifications and no longer prompts me for it. I've checked with other apps and indeed, after I delete and reinstall them, they won't prompt me again for permissions to receive push notifications.

    So my questions are:

    • Does this theory make sense?
    • If it does, this means I'll have to ask the client to generate a new distribution provisioning profile. How can I verify that this profile is "push enabled"? (i.e. considering that I can't just install an app compiled with it)