如何修复“没有为应用程序找到有效的‘aps-environment’权利字符串"在 Xcode 4.3 中? [英] How to fix "no valid 'aps-environment' entitlement string found for application" in Xcode 4.3?

查看:24
本文介绍了如何修复“没有为应用程序找到有效的‘aps-environment’权利字符串"在 Xcode 4.3 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在非常努力地尝试创建一个简单的 iOS 应用程序,它可以接收推送通知.我这样做的唯一原因是建立一个程序供其他一些团队成员使用,并且无法在网络上的其他地方找到此类说明的最新工作版本.我们的商店对 iOS 开发人员来说是相当新的,我个人对 iOS 开发人员和 Xcode 完全没有经验.我偶然发现了来自 Apple 和其他地方的数十篇教程、文章和问题帖子,我觉得我可能快到了......

I've been trying very very hard to create a simple simple iOS app which can recieve push notifications. My only reason for doing this is to establish a procedure for some other team members to use, and have not been able to find an up to date, working version of such instructions elsewhere on the web. Our shop is fairly new to iOS dev, I personally am completely inexperienced with iOS dev and Xcode. I've stumbled through tens of tutorials, articles, and trouble posts from Apple and elsewhere and I feel like I might be nearly there...

这是我必须要做的(注意,我使用的是 Xcode 4.3 并尝试最初仅部署到 iOS 5.1,我认为最近与早期版本的 Xcode 相比,某些事情可能发生了变化,但我再次所有这一切都是新的——并且发现它完全令人困惑和复杂):

Here is where I've got to (note I'm using Xcode 4.3 and trying initially to deploy just to iOS 5.1, and I gather that some things may have changed recently vs earlier versions of Xcode, but again I'm new to all this -- and finding it completely confusing and convoluted):

1) 我的 iPhone 上有一个启用了推送功能的配置文件

1) I've got a provisioning profile on my iPhone which has Push enabled

2) 在我的测试 Xcode 项目中,我选择了配置文件作为签名标识(在构建设置 > 代码签名中)

2) In my test Xcode project I've got that provisioning profile selected as the signing identity (in Build Settings > Code Signing)

3) 我在摘要和信息">自定义 iOS 目标属性"下设置了我的包标识符*(我认为??)

3) I've got my bundle identifier under Summary and Info > Custom iOS Target Properties set properly* (I think??)

4) 我在委托的 didFinishLaunchingWithOptions 中调用了 registerForRemoteNotificationTypes

4) I've got registerForRemoteNotificationTypes being called in my delegate's didFinishLaunchingWithOptions

5) 我的委托中有 didRegisterForRemoteNotificationsWithDeviceToken 和 didFailToRegisterForRemoteNotificationsWithError,设置为分别记录设备令牌或错误

5) I've got didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError in my delegate, set up to log the device token or error respectively

6) 我在摘要下选中了启用权利.

6) I've got Enable Entitlements checked under Summary.

7) 在选择的权利文件的正下方是 Tinker6(我的测试项目的名称),它是在我选中启用权利时自动生成的

7) Right below that the Entitlements File selected is Tinker6 (the name of my test project), which was generated automatically when I checked Enable Entitlements

8) 在 Tinker6.entitlements 文件中,我有以下内容(根据网络上的几个不同帖子,我收集到的内容是正确的,但我无法从 Apple 本身找到任何明确的内容):

8) In the Tinker6.entitlements file I've got the following (which I've gathered is correct based on several different posts all over the web, but which I can't find anything definitive from Apple itself on):

更新

9) 另外,我在没有权利文件的情况下尝试了整个过程,并得到了基本相同的结果.

9) Also, I have tried the whole thing without an entitlements file, and get essentially the same result.

10) 我的 mobileprovision 文件内容正确地包含了权利(我已经对数字和域进行了加扰,但结构上是相同的):

10) My mobileprovision file contents include entitlements properly (I've scrambled the number and domain but structurally the same):

<key>application-identifier</key>
<string>12355456A7.com.whatever.tinker</string>
<key>aps-environment</key>
<string>development</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
    <string>12355456A7.*</string>
</array>

/结束更新

当我尝试在我的设备上运行它时,我在 Xcode 输出中收到以下错误:

When I attempt to run this on my device, I get the following error in Xcode output:

2012-06-11 12:45:23.762 Tinker6[13332:707] Failed to get token, error: 
Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' 
entitlement string found for application" UserInfo=0x24a3b0 
{NSLocalizedDescription=no valid 'aps-environment' entitlement string 
found for application}

我尝试将 get-task-allow 设置为 NO,将 aps-environment 设置为生产,所有四种可能的组合,同样的事情.

I've tried setting get-task-allow to NO, aps-environment to production, all four possible combinations, same thing.

我怎样才能克服这个问题?哪里有这方面的权威文档?

How can I get past this? Where is definitive documentation on this?

-- 进一步的背景介绍 --

*至于 bundle id,我仍然不清楚应该如何相对于 Provisioning profile 中的 App Id 和 Profile id 设置它.在 App Ids 下的 Provisioning 门户中,我有这个(再次打乱数字和域):

*As far as the bundle id, I am still not clear on how this should be set in relation to App Ids and Profile ids in the Provisioning profile. In the Provisioning portal under App Ids I have this (again, scrambled the number and domain):

并且设置了两个地方的 bundle id 我有这个:

And the two places bundle id is set I have this:

我完全不确定这些是否正确,或者是否应该将其中一个或两个都设置为 12355456A7.com.whatever.tinker,尽管我在此过程的早期尝试过这些但没有成功......

I am not at all sure these are correct or whether one or both should be set to 12355456A7.com.whatever.tinker, though I've tried those earlier in the process with no success...

注意我意识到有很多帖子具有相似的标题,但是根据给定的文件名和等等,它们似乎都已过时,而且事实上没有一个解决方案似乎有用.我希望我提供的更详细的信息将保证高质量的回复.我可能会尽快分配赏金,如果您提供高质量的答案以找到解决方案,我将奖励您并通过 Twitter 和我的博客宣传您的答案.特别是如果您在博客或其他任何内容上交叉发布了一篇非常好的这是使简单的推送通知应用程序正常工作所需的确切 500 个步骤,包括配置和其他任何内容".

Note I realize there are many posts with similar titles, however they all seem to be out of date based on the file names and so-forth given, and the fact none of the solutions seem to be useful. I'm hoping the greater level of detail I've given will warrant a quality response. I will probably assign a bounty as soon as possible and if you give a high quality answer that leads to a solution I will award you the bounty as well as promote your answer via twitter and my blog. Especially if you crosspost post a really good "here are the exact 500 steps you need to get a simple push notification app working including provisioning and whatever else" article on your blog or whatever.

推荐答案

答案是:重新开始,做所有相同的事情,但创建一个新的配置文件,然后安装它.那行得通.检查所有细节(移动提供中的权利)看起来与我在这里的问题中的所有内容完全相同.但现在它起作用了.苹果:WAT?

The answer was: start over, do everything the same but create a new provisioning profile, and install it. That worked. Inspecting all the details (entitlements in mobile provision) looks exactly the same as everything in my question here. But now it works. Apple: WAT?

当然,如果可以删除配置文件,那么这样做就很明显了.但由于这是不可能的,我不想让我们的团队用一堆测试配置文件混乱.尽管如此,最终还是失去了耐心并尝试了它,最终还是成功了.什么.

Of course, it would have been obvious to do this if it was possible to delete provisioning profiles. But since that's not possible, I didn't want to clutter our team with a bunch of test profiles. Still, finally lost patience and tried it anyway, and it ended up working. Whatevs.

这篇关于如何修复“没有为应用程序找到有效的‘aps-environment’权利字符串"在 Xcode 4.3 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆