apple push notification not working in production

前端 未结 1 1411
遥遥无期
遥遥无期 2020-12-03 03:07

We are totally stucked, please help.

I and my team made a iPhone application, and this is the first time we try on iOS.

Everything is fine, until we submitte

相关标签:
1条回答
  • 2020-12-03 03:30

    The comment above is incorrect. The app ID has a prefix before the bundle ID :

    An application ID consists of an application’s bundle ID prefixed with a ten-character code generated by Apple. The team admin must enter the bundle ID. For a certificate, it must incorporate a specific bundle ID; you cannot use a “wildcard” application ID.

    You should check your provisioning profile, to make sure it contains the correct aps entitlement :

    Verify that the entitlements in the provisioning-profile file are correct. To do this, open the .mobileprovision file in a text editor. The contents of the file are structured in XML. In the Entitlements dictionary locate the aps-environment key. For a development provisioning profile, the string value of this key should be development; for a distribution provisioning profile, the string value should be production.

    You should make sure you are using production device tokens when sending push notifications to the production APNS server (device tokens that works in the sandbox environment don't work in the production env).

    You should have tested your app with an AdHoc provisioning profile prior to releasing it to the app store. The AdHoc profile works with the production push environment.

    EDIT :

    Some quotes regarding device tokens :

    From the Local and Push Notification Programming Guide :

    Take note that the device token in the production environment and the device token in the development (sandbox) environment are not the same value.

    From Technical Note TN2265 :

    Handling Malformed Notifications

    The simple binary interface drops the connection if the push service receives a notification that is incorrect in some way. Your provider may see this as an EPIPE or broken pipe error in response to sending a notification. On the other hand, the enhanced binary interface will send an error response with more detailed information about what was wrong with the notification before dropping the connection. Be sure your provider catches and handles these conditions properly.

    The most common problem is an invalid device token. If the token came from the sandbox environment, such as when you are testing a development build in house, you can't send it to the production push service. Each push environment will issue a different token for the same device or computer. If you do send a device token to the wrong environment, the push service will see that as an invalid token and discard the notification.

    Finally, this article has a good explanation of how sending multiple notifications to Apple when some of the notifications are invalid (the most common cause being invalid device tokens), can cause some of the valid notifications not to arrive as well.

    0 讨论(0)
提交回复
热议问题