ios 代码设计错误:删除过期配置文件后找不到配置文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1760518/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Codesign error: Provisioning profile cannot be found after deleting expired profile
提问by quantumpotato
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:
试图重建一个昨天才运行的应用程序。收到一条消息,说明配置文件已过期,因此我将其从 iPod 和 iTunes 中删除。当我选择一个新的配置文件(标识符中带有 * 的配置文件)时,我现在收到一个错误:
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.
我错过了什么?我查看了相关问题,但还没有看到这种情况。
回答by Brad The App Guy
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 项目文件会搞砸,特别是如果您有一个旧项目并且首先使用旧版本的 xcode/iphone sdk 创建它。您需要做的是在文本编辑器中打开项目文件,从错误中搜索“长字符串”并手动擦除该行。事实上,您应该继续并擦除指向任何配置文件的任何行。然后在 xcode 中重新打开项目,转到设置并重新选择您的新配置文件。大多数情况下,这可以解决类似的问题。指向配置文件的行将如下所示:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
回答by Ori
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.
在 XCode 中,在“组和文件”窗格中,展开“目标”并双击应用程序的目标。这将打开目标的信息窗格。在“构建”部分,检查任何旧配置文件的“代码签名”部分并替换为正确的配置文件。
Note that this is different from double-clicking on your project icon and changing the profile from there. Quite amazing :)
请注意,这与双击项目图标并从那里更改配置文件不同。相当惊人:)
Ori
织里
回答by user732414
- Project&Targets Properties -> "Don't Code Sign" -> OK -> cmd+S(or cmd+B);
Project&Targets Properties -> "Your Provision Profile"-> OK
Everything works again!
- Project&Targets Properties -> "Don't Code Sign" -> OK -> cmd+S(or cmd+B);
项目和目标属性->“您的配置文件”-> 确定
一切重新开始!
回答by matt
I agree with Brad's answer, that you can fix this problem by editing your target/project by hand, deleting any lines like this:
我同意 Brad 的回答,您可以通过手动编辑目标/项目来解决这个问题,删除任何这样的行:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
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.
但是,在 Xcode 4.2 及更高版本中,有一种更简单的方法来访问此文本并选择和删除它。在左侧的 Project Navigator 中,选择您的项目(Project Navigator 的最上面一行)。现在只需选择“查看”>“版本编辑器”>“显示版本编辑器”。这会将您的项目显示为文本,您可以搜索 PROVISIONING 并删除麻烦的行,就在 Xcode 的编辑器窗格中。
回答by theevank
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.
刚刚看到这个问题的一个变体:我按照上面 Brad Smith 的注释进入了 project.pbxproj 文件,除了在这种情况下,所有 PROVISIONING_PROFILE 行似乎都是正确的,没有出现 XCode 不能的“坏”配置文件字符串找不到。
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.
但是,修复方法是相同的:删除 project.pbxproj 中的所有 PROVISIONING_PROFILE 行,即使它们理论上看起来“不错”,然后在 XCode 中重新打开项目。
回答by MechEngineer
To achieve Brad's solution entirely in Terminal, use these commands
要完全在终端中实现 Brad 的解决方案,请使用这些命令
cd [Xcode project parent]
vi [Xcode project name].xcodeproj/project.pbxproj
/[offending provisioning profile] [Enter]
dd
- delete the entire line- Press n until no more are found
- Ctrl+x to save and close
cd [Xcode project parent]
vi [Xcode project name].xcodeproj/project.pbxproj
/[offending provisioning profile] [Enter]
dd
- 删除整行- 按 n 直到找不到更多
- Ctrl+x 保存并关闭
回答by bobbypage
Just spent a hour or so doing this and with the help of Brad's advice and a few additional changes it all worked.
只花了一个小时左右的时间就这样做了,在 Brad 的建议和一些其他更改的帮助下,一切都奏效了。
I've done this using the following: 10.7.3, Xcode 4.3.2, iOS 5.1 btw.
我使用以下代码完成了此操作:10.7.3、Xcode 4.3.2、iOS 5.1 顺便说一句。
1) Right click on your myapp.xcodeproj
and select package contents
1)右键单击您的myapp.xcodeproj
并选择包内容
2) open project.pbxproj
with a text editor (don't recommend textedit as it may screw up the formatting)
2)project.pbxproj
用文本编辑器打开(不推荐 textedit,因为它可能会搞乱格式)
3) Scroll all the way down until you find /* Begin XCBuildConfiguration section */
3)一直向下滚动,直到找到 /* Begin XCBuildConfiguration section */
4) Notice that you have a debug and release sections
4) 请注意,您有一个调试和发布部分
5) In the release section take a look at CODE_SIGN_IDENTITY
& "CODE_SIGN_IDENTITY[sdk=iphoneos*]"
it should look something like this:
5)在发布部分,看看CODE_SIGN_IDENTITY
&"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
它应该是这样的:
CODE_SIGN_IDENTITY = "iPhone Distribution: MyCompany LLC";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: MyCompany LLC";
6) Take a look at PROVISIONING_PROFILE
and "PROVISIONING_PROFILE[sdk=iphoneos*]"
they should look like this:
6)看看PROVISIONING_PROFILE
和"PROVISIONING_PROFILE[sdk=iphoneos*]"
他们应该是这样的:
PROVISIONING_PROFILE = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
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.
这应该与您在 Xcode 中的配置文件匹配。要查看它们是否匹配,请打开 Xcode > Window > Organizer > Devices > Provisioning Profiles > 右键单击配置文件 > 在 Finder 中显示 > .mobileprovision 的文件名是您的配置文件 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 */
7) 向下滚动project.pbxproj
并找到发布部分的第二个实例。发布部分的第二个实例应该以评论结束/* End XCBuildConfiguration section */
8) make sure that the second section matches the first section so that CODE_SIGN_IDENTITY, "CODE_SIGN_IDENTITY[sdk=iphoneos*]
, and PROVISIONING_PROFILE
are all filled in.
8) 确保第二部分与第一部分匹配,以便CODE_SIGN_IDENTITY, "CODE_SIGN_IDENTITY[sdk=iphoneos*]
、 和PROVISIONING_PROFILE
全部填写。
回答by stack-o-frankie
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.
在我的情况下,问题是通过打开窗口 -> 管理器,选择我的设备并删除右侧“配置”面板下的旧配置文件来解决的。旧的已经标有红色的“x”符号,但 iPhone 仍在使用它。
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.
除了那个配置文件之外,新的配置文件也出现了(具有相同的名称),在简单地重新启动应用程序后,我让它运行顺利。
回答by Richard Brown
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.
我会提出一个建议,因为还没有人说过:请在开始修改它的内容之前,请先备份整个 .xcodeproj 文件。搞砸项目文件并且没有备份会导致非常非常不愉快的体验。
Being able to back out of an edit can be a godsend.
能够退出编辑可能是天赐之物。
回答by GeneCode
I just encountered this problem in my XCode4. To fix it, you need to put all the correct provisions into both Debug and Release config.
我刚刚在我的 XCode4 中遇到了这个问题。要修复它,您需要将所有正确的规定放入 Debug 和 Release 配置中。
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.
我试图提交(通过归档)我的应用程序。所以我只是将 Debug 条款更改为“Don't Code Sign”,并将 Release 条款更改为我的应用程序的 appstore 条款。
This fix it and enables me to archive normally. Hope that helps.
这可以修复它并使我能够正常存档。希望有帮助。