Ryan Martin
Ryan Martin

Reputation: 1693

iOS push notifications nightmares, Provisions app IDs and certificates

Hey Apple developers, I'm pulling my hair out trying to figure out how iOS provisioning profiles, certificates and app IDs work with push notifications. I thought I was close to getting this to work, but maybe not.

When I run my app and attempt to register push notifications, I get this error in the console:

2012-06-26 17:52:29.380 Grouped[1732:707] badgeNumber: 0
2012-06-26 17:52:30.089 Grouped[1732:707] [INFO] device is ready
2012-06-26 17:52:32.654 Grouped[1732:707] JSLOG: Registering with APNS via the App Delegate
2012-06-26 17:52:32.655 Grouped[1732:707] Register success callback set
2012-06-26 17:52:32.661 Grouped[1732:707] didFailToRegisterForRemoteNotificationsWithError:Error 
Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for 
application" UserInfo=0x18a0c0 {NSLocalizedDescription=no valid 'aps-environment' 
entitlement string found for application}

I've done several hours of research now and can't figure out what I'm doing wrong. I've created a new provisioning profile that is linked to my app ID. I can see it on my phone.

Any ideas?

Bonus question: Why on earth is it so complicated to properly provision an iOS app for push notifications?

Upvotes: 3

Views: 2621

Answers (3)

RickJansen
RickJansen

Reputation: 1713

Be sure to create new adhoc/appstore profiles AFTER you created push certificates for your app. The distribution profiles change after enabling the App for push messages.

Upvotes: 1

OpenUserX03
OpenUserX03

Reputation: 1458

"no valid 'aps-environment' entitlement string found for 
application"

Your provision profile doesn't have push notifications enabled. Make sure you enabled them in the provisioning portal, generate a new profile, but more importantly make sure you actually installed it in Xcode and are signing your app with that profile. That last part has bitten me a couple times.

Upvotes: 1

Jesse Rusak
Jesse Rusak

Reputation: 57168

A couple things to check:

  • Do you have any other provisioning profiles for this app on your device? I'd delete them.
  • Does your App ID have push enabled in the provisioning portal?
  • Are you sure you're signing with the correct profile? It has to be a non-wildcard development certificate.
  • Are you specifying your own entitlements.plist file? Modern Xcode generates one, so you don't need to do this. Make sure your "Code Signing Entitlements" build setting is empty.

If you haven't already found it, Apple has a good FAQ about this:

http://developer.apple.com/library/ios/#technotes/tn2265/_index.html

Upvotes: 7

Related Questions