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

你说的曾经没有我的故事 提交于 2019-12-03 11:31:21

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 :)

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.

Make sure that the distribution provisioning profile is generated after creating aps_certificate. High changes the profile may miss out aps-environment

I added the following to AppDelegate.m so I could see exactly what settings were enabled in debug

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  UIRemoteNotificationType enabledTypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
NSLog(@"Receiving Notification Types: %lu", (long)enabledTypes); //0=none 1=badge 2=sound 4=alert 8=NewsStandContantAvailability

I got this from a Very inclusive and useful link: Apple Push Notification Service Tutorial - Part 1 it was extremely helpful for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!