Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apple push notifications - no valid 'aps-environment' have tried all solutions I've seen on web?

I'm tearing my hair out trying to get push notifications to work! I'm following this tutorial to basically no avail. I've deleted xcode several times, redone the whole apple dev certificate, cleaned out my login keychain a few times. This has helped a few issues, but at the end I'm still stuck.

What I think I need to do (from reading other people's experience with this): 1) My openssl cert and key need to be talk to the apple server 2) The app id with this openssl cert has a provisioning profile associated with it. 3) The build (in xcode) needs to have the proper provisioning profile associated with it 4) The build identifier (in xcode) needs to have the same text as the application id with the provisioning profile 4) ???

As far as I can tell, all of this is ok:

  1. My ssl certificate + key talk nicely to the apple server (ignore the error, I still get a prompt eventually):

MacBook-Pro:apple_dev_certification nflacco$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -key xxx.pem -cert xxx.pem Enter pass phrase for xxx.pem: CONNECTED(00000003) depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C verify error:num=20:unable to get local issuer certificate .....

2,3,4) When I create a new project, it never gets the right app ip (build settings->info-bundle identifier). If my provisioning profile matches 'com.xxx' then the app will always be 'com.xxx.FOO', so the default IOS Team Provisioning Profile is selected. I run the app like that, and get:

2011-10-22 22:42:45.086 VVV[3552:707] Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x16d140 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

4 contd) I want to use my provisioning profile that uses my app id with push enabled, so I change the app identifier to 'com.xxx', and select the proper profile in the code signing option in the build menu. Install it on my iPhone, same thing :(

The only things I can think of:

  • My provisioning profile is not correct? I've made a new one several times, deleted the all existing ones in xcode organizer, but this hasn't helped.
  • Code is still getting signed with the Team Profile instead of my new one? Is there a way to ensure this?

Any ideas on what I should do here? This can't be this complicated. Should I just wipe my HD and reinstall from scratch and hope it works?

like image 349
nflacco Avatar asked Oct 23 '11 06:10

nflacco


1 Answers

You know what it was? My app id.

foo.bar is treated as foo.bar.* (which is not permitted)

you have to have foo.bar.xxx

enter image description here

like image 192
nflacco Avatar answered Nov 15 '22 16:11

nflacco