苹果推送通知 - 没有有效的“aps-environment”已尝试过我在网上看到的所有解决方案?
我正在绞尽脑汁地试图让推送通知发挥作用!我按照本教程基本上没有有用。我已经删除了几次 xcode,重做了整个苹果开发证书,清理了我的登录钥匙串几次。这已经解决了一些问题,但最终我仍然陷入困境。
我认为我需要做什么(通过阅读其他人的经验): 1)我的openssl证书和密钥需要与苹果服务器对话 2) 具有此 openssl 证书的应用程序 ID 具有与其关联的配置文件。 3) 构建(在 xcode 中)需要具有与其关联的正确配置文件 4) 构建标识符(在 xcode 中)需要与配置文件中的应用程序 ID 具有相同的文本 4)???
据我所知,所有这些都可以:
- 我的 ssl 证书 + 密钥与苹果服务器很好地对话(忽略该错误,最终我仍然收到提示):
MacBook-Pro:apple_dev_certification nflacco$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -key xxx.pem -cert xxx.pem 输入 xxx.pem 的密码:CONNECTED(00000003) 深度=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa 通过引用合并/OU=(c) 2009 Entrust, Inc./CN=Entrust 证书颁发机构 - L1C 验证 错误:num=20:无法获取本地颁发者证书......
2,3,4)当我创建新项目时,它永远不会获取正确的应用程序IP(构建设置->信息包标识符)。如果我的配置文件与“com.xxx”匹配,则应用程序将始终为“com.xxx.FOO”,因此选择默认的 IOS 团队配置配置文件。我像这样运行应用程序,并得到:
2011-10-22 22:42:45.086 VVV[3552:707] 获取令牌失败,错误: 错误域 = NSCocoaErrorDomain 代码 = 3000“没有有效的‘aps-环境’ 找到应用程序的权利字符串“UserInfo=0x16d140 {NSLocalizedDescription=没有有效的“aps-environment”权利字符串 找到了应用程序}
4 续)我想使用我的配置文件,该配置文件使用启用了推送的应用程序 ID,因此我将应用程序标识符更改为“com.xxx”,并在构建菜单的代码签名选项中选择正确的配置文件。将其安装在我的 iPhone 上,同样的事情:(
我唯一能想到的事情是:
- 我的配置文件不正确?我已经制作了一个新的配置文件 次,删除了Xcode Organizer中所有现有的,但是这个 没有帮助。
- 代码仍在使用团队配置文件而不是我的新配置文件进行签名 一?有没有办法保证这一点?
关于我应该在这里做什么有什么想法吗?这不可能这么复杂。我是否应该擦除我的硬盘并从头开始重新安装并希望它能正常工作?
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:
- 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你知道那是什么吗?我的应用程序 ID。
foo.bar 被视为 foo.bar.* (这是不允许的)
你必须有 foo.bar.xxx
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
我认为对于推送,您需要一个 Entitlements.plist 文件,该文件具有 aps-environment 密钥,其值为“生产”。我刚刚完成了我的应用程序(再次)的工作。这里的其他一些答案帮助我在完成存档后弹出管理器窗口,但后来我收到了您的错误。
我也不得不退出&以一定频率重新启动XCode,触摸实际上没有改变的设置,删除旧的、预推送证书并添加新的等等。XCode中的很多设置实际上没有改变,但看起来像是触摸他们让它开始工作。
I think for push you need an Entitlements.plist file that has an aps-environment key, with a value of "production". I just got finished getting this working (again) for my app. Some other answers here helped me get the Organizer window to pop up after I did the Archive, but then I was getting your error.
I also had to quit & restart XCode with some frequency, touch settings that didn't actually change, delete the old, pre-push certificate and add the new one, etc etc. A lot of the settings in XCode didn't actually change, but it seems like touching them caused it to start working.