Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push notifications work for Ad Hoc, but not when downloaded from the Apple store

My app just got approved for the apple store. I downloaded it an installed it on my iPhone - but it looks like push notifications are broken!

I was successfully testing push notifications in production using an adHoc provisioning profile. I had no problems. The only thing I did differently when I submitted to apple was using an app store distribution profile.

The application never asks me (or anyone else who has downloaded it) if I want to receive push notifications. Consequently, the phone never talks to my server to send the push token (because application:didRegisterForRemoteNotificationsWithDeviceToken: is presumably never called). Also the application does not appear in the settings app under the notification settings.

What could I be doing wrong??

EDIT: While the app was awaiting approval, I was having some trouble generating my production push certificate. Could this be relevant?

Problem generating APN SSL certificate after submitting to apple store

like image 400
MikeQ Avatar asked Apr 10 '10 21:04

MikeQ


People also ask

Why push notification is not working for iOS?

Go to iOS' settings → "Your app name" → Notifications to ensure notifications are enabled for your app. You will need to restart your app after enabling push notifications. If you find a recent install with a push token in the debug tool, make sure your app is not opened in the foreground during your tests.

Do push notifications work when app is closed iOS?

Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.

Why are push notifications not working?

One of the main reasons why your phone's notifications aren't working could be due to broken app updates. If your Android device is not getting notifications from one app in particular, it's possible that the developers have accidentally rolled out a buggy update.

Does Apple support push notifications?

How Apple Push Notification Service connects. To use Apple Push Notification Service (APNs), your macOS, iOS, tvOS, and watchOS devices need a persistent connection to Apple's servers over Ethernet, cellular data (if capable), or Wi-Fi.


2 Answers

Be sure you've created your production App ID and have enable push notifications upon it. Then create the provisioning profile for that app. Download and open the file with a text editor to MUST make sure that the profile contains this key and value:

aps-environment production

If not, then make sure you really have enabled the app ID for production push before you generated your provisioning profile.

After you make your build, you can check the final build to verify it has the aps-environment entitlement (you're looking for the aps-environment code signing entitlement under "Internal requirements):

codesign -dvvvv --entitlements - MyCoolApp.app

like image 103
tonyj Avatar answered Nov 03 '22 06:11

tonyj


Did you use the same Application ID for both the ad-hoc and the distribution mobileprovision files? It needs to be a complete identifier, rather than just partial.

like image 35
Ben Gottlieb Avatar answered Nov 03 '22 06:11

Ben Gottlieb