代码设计错误:删除过期的配置文件后找不到配置文件
尝试重建昨天才可以运行的应用程序。收到一条配置文件已过期的消息,因此我将其从 iPod 和 iTunes 中删除。当我选择一个新的配置文件(标识符中带有 * 的配置文件)时,我现在收到错误:
代码签名错误:找不到配置文件(长字符串)。
我缺少什么?我查看了相关问题,还没有看到这种情况。
Tried to rebuild an app that was working just yesterday. Got a message that a profile had expired, so I removed it from the iPod and from iTunes. When I chose a new profile (one with an * in the identifier), I now get an error:
Code Sign Error: Provisioning Profile (long string) can't be found.
What am I missing? I looked through related questions and didn't see this scenario already.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(16)
有时您的 Xcode 项目文件会变得混乱,特别是如果您有一个旧项目并且首先使用旧版本的 Xcode/iPhone SDK 创建它。
您需要做的是在文本编辑器中打开项目文件,从错误中搜索“长字符串”并手动删除该行。
事实上,您应该继续并删除指向任何配置文件的任何行。然后在 Xcode 中重新打开项目,转到设置并重新选择新的配置文件。这在大多数情况下都可以解决类似的问题。
指向配置文件的行将如下所示:
Sometimes your Xcode project file gets messed up, especially if you have an old project and first created it with an older version of Xcode/iPhone SDK.
What you need to do is open up the project file in a text editor, search for the 'long string' from your error and manually erase that line.
In fact, you should just go ahead and erase any line that points to any provisioning profiles. Then reopen the project in Xcode, go to the settings and reselect your new profile. This clears up issues like that most of the time.
The lines that point to the provisioning profiles will look like this:
这是一个适合我的更简单的解决方案,不需要手动编辑项目文件:
在 Xcode 中的“组和文件”窗格中,展开“目标”并双击应用程序的目标。这将打开目标的信息窗格。在“构建”部分中,检查“代码签名”部分中是否有任何旧配置文件,并替换为正确的配置文件。
请注意,这与双击项目图标并从那里更改配置文件不同。相当惊人:)
奥里
Here's a simpler solution that worked for me and which doesn't require the manual editing of the project file:
In Xcode, in the "Groups & Files" pane, expand "Targets" and double-click on your app's target. This brings up the Info pane for the target. In the "Build" section, check the "code signing" section for any old profiles and replace with the correct one.
Note that this is different from double-clicking on your project icon and changing the profile from there. Quite amazing :)
Ori
项目和目标属性 -> “您的配置文件”->确定
一切恢复正常!
Project&Targets Properties -> "Your Provision Profile"-> OK
Everything works again!
我同意 Brad 的回答,您可以通过手动编辑目标/项目,删除如下所示的任何行来解决此问题:
但是,在 Xcode 4.2 及更高版本中,有一种更简单的方法来访问此文本并选择和删除它。在左侧的项目导航器中,选择您的项目(项目导航器的最上面一行)。现在只需选择“查看”>“版本编辑器>显示版本编辑器。这会将您的项目显示为文本,您可以在 Xcode 的编辑器窗格中搜索 PROVISIONING 并删除麻烦的行。
I agree with Brad's answer, that you can fix this problem by editing your target/project by hand, deleting any lines like this:
However, in Xcode 4.2 and later, there is a much easier way to access this text and select and delete it. In the Project Navigator on the left, select your project (the topmost line of the Project Navigator). Now simply choose View > Version Editor > Show Version Editor. This displays your project as text, and you can search for PROVISIONING and delete the troublesome line, right there in the editor pane of Xcode.
刚刚看到这个问题的一个变体:我按照上面 Brad Smith 的注释进入了 project.pbxproj 文件,除了在这种情况下,所有 PROVISIONING_PROFILE 行似乎都是正确的,没有出现 Xcode 无法识别的“坏”配置文件字符串没找到。
然而,修复方法是相同的:删除project.pbxproj中的所有PROVISIONING_PROFILE行,即使它们在理论上看起来“不错”,然后在Xcode中重新打开项目。
Just saw a variation on this issue: I went into the project.pbxproj file as per Brad Smith's notes above, except in this case all of the PROVISIONING_PROFILE lines seemed to be correct, with no occurrence of the "bad" profile string that Xcode couldn't find.
However, the fix was the same: deleting ALL of the PROVISIONING_PROFILE lines in project.pbxproj, even though they looked "good" in theory, and then reopening the project in Xcode.
要完全在终端中实现 Brad 的解决方案,请使用以下命令
cd [Xcode 项目父级]
vi [Xcode 项目名称].xcodeproj/project.pbxproj
/[offending Provisioning profile] [Enter]
dd
- 删除整行To achieve Brad's solution entirely in Terminal, use these commands
cd [Xcode project parent]
vi [Xcode project name].xcodeproj/project.pbxproj
/[offending provisioning profile] [Enter]
dd
- delete the entire line就我而言,问题是通过打开 Window -> 解决的。组织者,选择我的设备并删除右侧“配置”面板下旧的配置配置文件。旧的已经标有红色“x”符号,但 iPhone 仍在使用它。
除了该配置文件之外,还显示了新的配置文件(具有相同的名称),并且在简单地重新启动应用程序后,我就让它顺利运行了。
In my case the problem was solved by opening Window -> Organizer, selecting my device and removing the old Provisioning Profile under the "Provisioning" panel on the right. The old one was already marked with a red "x" symbol but the iPhone was still using it.
Besides that profile, also the new one was showing up (with the same name) and after simply relaunching the application I had it running smoothly.
只是花了一个小时左右的时间来做这件事,在布拉德的建议和一些额外的改变的帮助下,一切都奏效了。
我使用以下版本完成此操作:10.7.3、Xcode 4.3.2、iOS 5.1 顺便说一句。
1) 右键单击
myapp.xcodeproj
并选择包内容2) 使用文本编辑器打开
project.pbxproj
(不推荐使用 textedit,因为它可能会搞乱格式) )3) 一直向下滚动,直到找到
/* Begin XCBuildConfiguration 部分 */
4) 请注意,您有调试和发布部分
5) 在发布部分中查看
CODE_SIGN_IDENTITY
&"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
它应该看起来像这样:6) 看一下
PROVISIONING_PROFILE
和"PROVISIONING_PROFILE[sdk=iphoneos*]"
它们应该如下所示:这应该与 Xcode 中的配置文件匹配。要查看它们是否匹配,请打开 Xcode >窗口>组织者>设备>配置文件>右键单击个人资料>在 Finder 中显示 > .mobileprovision 的文件名是您的个人资料 ID。
7) 在
project.pbxproj
中向下滚动并找到发布部分的第二个实例。发布部分的第二个实例应以注释结尾/* End XCBuildConfiguration section */
8) 确保第二部分与第一部分匹配,以便
CODE_SIGN_IDENTITY, "CODE_SIGN_IDENTITY[sdk =iphoneos*]
和PROVISIONING_PROFILE
均已填写。Just spent a hour or so doing this and with the help of Brad's advice and a few additional changes it all worked.
I've done this using the following: 10.7.3, Xcode 4.3.2, iOS 5.1 btw.
1) Right click on your
myapp.xcodeproj
and select package contents2) open
project.pbxproj
with a text editor (don't recommend textedit as it may screw up the formatting)3) Scroll all the way down until you find
/* Begin XCBuildConfiguration section */
4) Notice that you have a debug and release sections
5) In the release section take a look at
CODE_SIGN_IDENTITY
&"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
it should look something like this:6) Take a look at
PROVISIONING_PROFILE
and"PROVISIONING_PROFILE[sdk=iphoneos*]"
they should look like this:This should match your provisioning profile in Xcode. To see if they match open Xcode > Window > Organizer > Devices > Provisioning Profiles > Right click on the profile > Reveal in Finder > The filename of the .mobileprovision is your profile id.
7) Scroll down in the
project.pbxproj
and find a second instance of the release section. The second instance of the release section should end with a comment saying/* End XCBuildConfiguration section */
8) make sure that the second section matches the first section so that
CODE_SIGN_IDENTITY, "CODE_SIGN_IDENTITY[sdk=iphoneos*]
, andPROVISIONING_PROFILE
are all filled in.由于还没有人说过,我将提出一个建议:请在开始修改 .xcodeproj 文件的内容之前先备份整个 .xcodeproj 文件。搞砸项目文件并且没有备份将导致非常非常不愉快的体验。
能够退出编辑可能是天赐之物。
One suggestion I'll make since no one yet has said it: PLEASE PLEASE PLEASE make a backup of your whole .xcodeproj file BEFORE you start modifying it's contents. Screwing up the project file and having no backup will lead to a very very unpleasant experience.
Being able to back out of an edit can be a godsend.
选择协同签名中“任何 iOS SDK”下的空白行,然后选择正确的证书。
Select the lines in codesigning that are blank under Any iOS SDK and select the right certificate.
Brad Smith 的解决方案对我有用,但我还必须删除 CODE_SIGN_IDENTITY 字段才能使其工作。
The solution of Brad Smith worked for me, but I also had to remove the CODE_SIGN_IDENTITY field to make it work.
我刚刚在 Xcode 4 中遇到这个问题。要修复它,
您需要将所有正确的规定放入调试和发布配置中。
我试图提交(通过存档)我的应用程序。因此,我只需将“调试”规定更改为“不进行代码签名”,并将“发布”规定更改为我的应用程序的应用商店规定。
这修复了它并使我能够正常存档。希望有帮助。
I just encountered this problem in my Xcode 4. To fix it,
you need to put all the correct provisions into both Debug and Release config.
I was trying to submit (by archiving) my app. So I just change the Debug provisions to "Don't Code Sign", and the Release provision to my app's appstore provision.
This fix it and enables me to archive normally. Hope that helps.
不幸的是,这种方法对我来说并不奏效。但这里有一个对我有用的修复(要让它工作,你需要 Subversion 等的工作项目文件):
我确实回滚到了我的项目文件的工作版本。因为无法使用 Xcode 进行恢复(哪里是 Xcode 4 源代码管理中的“恢复”选项吗?) - 我使用了 Tortoise、我的 Windows 机器和本教程 (http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html)回滚到较旧的项目文件。
由于教程对我来说并不适用,我只是使用 Tortoise 将项目文件的工作版本保存到 U 盘上,然后将其移植到我的 Mac 上。之后,我用旧的工作文件替换了新的损坏的项目文件,进行了清理,它的工作就像一个魅力!
Unfortunately this approach didn't work out for me. But here's a fix which worked for me (to get this to work you need a working project file on Subversion or so):
I did roll back to an working version of my project file. As it isn't possible to revert with Xcode (Where is the 'Revert' option in Xcode 4's Source Control?) - I used Tortoise, my Windows machine and this Tutorial (http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html) to roll back to an older project file.
As the Tutorial didn't work out for me, I just used Tortoise to save the working revision of my project file to an usb stick to port it to my mac. After that I replaced the new broken project file with the old working one, cleaned and it worked like a charm!
至少在 Xcode 5 中,这为我解决了问题:
在配置文件下,选择有问题的配置文件,然后在下拉菜单中选择有效的配置文件。
At least in Xcode 5, this is the thing that solved the problem for me:
Under provisioning profile, select the offending provisioning profile and then select a valid provisioning profile in the pull-down menu.
您可以删除配置文件的旧引用。然后导入新的配置文件并选择 Xcode 构建器。
You Could remove old reference of provisioning file. Then after import new provisioning Profile and selecting Xcode builder.
我遇到了问题,因为我使用一些在 TestFlight 上使用的新设备更新了我的 AdHoc 配置文件。假设发生这种情况是因为 Xcode 在项目或目标的协同签名构建设置中对您的配置文件有旧的引用。我修复的方法是:
I was having issues because I updated my AdHoc provisioning profile with some new devices for use on TestFlight. Assumedly this is happening because Xcode has an old reference to your provisioning profile in either the codesigning build settings for the project or the targets. The way I fixed mine was to: