ios - Push notifications not working after switching to Enterprise distribution -


i had push notifications working on app using ad hoc distribution. client bought enterprise license, , generated new certificates/profiles, archived app, , distributing via enterprise, push notifications no longer working. steps have take in order them working on enterprise version? thanks!

based on description sounds though did original implementation on appid registered under 1 developer account, , attempted migrated build second developer account.

in apns parlance, server generates push notification payload objects called provider , must register apns certificate keypair able establish secure connection between server , relevant apple push notification gateway (sandbox or production). keypair exclusive appid registered, , appids exclusive developer account under registered -- precise matching appid certificates registered under 1 account can not transferred second account. if possible, @ app's appid, register appid in own account , start sending spammy pushes app. thankfully, bundle seed id silent element appids , prevent situation occurring!

i've answered similar question apns provisioning might further clarify going on behind scenes, might give why can't add apns development ios typed certificate provisioning profile read.

if want see appids different can use couple of terminal commands export information original provisioning profile (where things working) , enterprise provisioning profile (where things aren't working) see differences:

copy , pasting following, taking care update path specific .mobileprovision:

/usr/libexec/plistbuddy -c 'print :entitlements' /dev/stdin <<< $(security cms -d -i /path/to/your/original.mobileprovision)

then run command second time updating path enterprise provisioning profile.

the output of command dictionary of key value pairs:

dict {   get-task-allow = true   aps-environment = development   com.apple.developer.team-identifier = abc1def2g3   application-identifier = xyzw1abc2d.com.mycompany.niftyapp   keychain-access-groups = array {       xyzw1abc2d.*   } } 

you'll notice output of these 2 commands different -- application-identifier section , keychain-access-groups section have different bundle seed ids.

so how fix it?

the fix quite simple , requires no additional development work in-app! will, however, need recompile new provisioning profile:

  • because you've set things need login enterprise account , enable push notifications in enterprise account's appid
  • while in appid's configuration, need generate new ssl keypair , submit apple did original account.
  • install new certificate , private key on push server
  • edit enterprise distribution provisioning profile, , install in xcode taking care remove old enterprise distribution provisioning profile.
  • rebuild application using new provisioning profile.

the rebuild may necessary because if enterprise appid didn't have push notifications enabled, enterprise distribution provisioning profile's entitlements block not contain aps-environment key , prohibited connecting apns gateways.


Comments