Xcode 无法识别我的新配置文件
我的应用程序的开发配置文件已在几周前过期,因此我前往配置门户获取全新的配置文件。获得它后,我访问了 Xcode Organizer,从我的设备和 Mac 中删除了过期的配置文件,然后导入了新的配置文件。 Xcode 立即将配置文件安装到我的设备上,并且我的应用程序再次在设备上运行。
问题是,虽然组织者能够看到新的配置文件并正常安装它,但 IDE 会混淆新旧配置文件。每次我尝试构建应用程序时,它都会立即失败。错误控制台告诉我 Xcode 找不到旧的配置文件,因为列出的 GUID 属于旧的配置文件。这很奇怪;我认为 Xcode 现在应该已经知道了新的配置文件。
我尝试从我的设备和 Mac 中删除新的配置文件,然后重新安装该配置文件。不行,Xcode 仍在尝试寻找旧的。我还尝试过选择一种不同的配置文件以使 Xcode 忘记旧的配置文件,然后选择新的配置文件。我什至尝试在其他选项中手动输入新GUID。然而 Xcode 仍然坚持寻找旧的配置文件,现在它已经从我的 Mac 上消失了。
如何让 Xcode 相信我已经为我的应用程序生成了一个新的配置文件以供其使用?
My app's development provisioning profile expired a couple of weeks ago, so I went to the provisioning portal to get a fresh new one. After obtaining it, I visited the Xcode Organizer, removed the expired profile from my devices as well as my Mac, then imported the new profile. Xcode installs the profile onto my devices immediately, and my app runs again on the devices.
The problem is that while the Organizer is able to see the new profile and install it as normal, the IDE gets confused between the old one and the new one. Every time I try to build the app, it fails immediately. The error console tells me that Xcode can't find the old profile, because the GUID listed belongs to the old one. That's strange; I thought Xcode would've been aware of the new profile by now.
I've tried removing the new profile from my devices and my Mac, then reinstalling the profile. Doesn't work, Xcode is still trying to look for the old one. I've also tried selecting a different profile to make Xcode forget the old one, then selecting the new one. I've even tried manually entering the GUID of the new one in the Other choice. Yet Xcode still insists on looking for the old profile, which by now is already gone from my Mac.
How do I convince Xcode that I've generated a new provisioning profile for my app for it to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
以下是我在 Xcode 4 中的做法:
Here's how I did it in Xcode 4:
我可以通过在代码签名身份中将其更改为“不要代码签名”来修复此错误。构建时,您会收到错误“产品类型需要代码签名......等等......”。然后返回并选择正确的配置文件。构建一切都很好。这发生在我身上,因为我的证书过期了,我更新了它。除了上述内容之外,我还必须从我的钥匙串和组织者中删除旧证书。
I was able to fix this error by changing it to "Don't Code Sign" in Code Signing Identity. Build, and you get the error "code signing is required for product type ...blah...". Then go back and select the right profile. Build and all good. This happened to me because my certificate expired and I renewed it. In addition to the above I also had to remove the old certificate from my keychain, and the Organizer.
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E8DEEBA3-FE0A-419F-9F7E-258572D55807";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E8DEEBA3-FE0A-419F-9F7E-258572D55807";
要添加到上面的解决方案,您可以使用可爱的xcodeproj gem 可以帮助解决此类问题。请注意,它确实会将 OpenStep
key = value;
样式的 plist 转换为 XML。注意:我发现如果您稍后在 Xcode 中更改项目文件,Xcode 会将其更改回来。无论是在 Xcode 中还是从命令行中,这两种类型的文件都可以很好地构建。有关我如何使用它的示例,以下是我如何使用它的要点: https://gist.github .com/82times/5594887
To add to the solution above, you can use the lovely xcodeproj gem to help with stuff like this. Note, it does convert your OpenStep
key = value;
-style plist to XML. Note: I have found that Xcode changes it back if you make project file changes in Xcode later. Either style of file builds fine either in Xcode or from the command line. For a sample of how I use itHere's a gist of how I use it: https://gist.github.com/82times/5594887
我对此问题的解决方案是:
/Users//Library/MobileDevice/Provisioning Profiles
My solution to this problem was:
/Users/<your.username>/Library/MobileDevice/Provisioning Profiles
大多数答案对我不起作用,因为它们似乎适用于旧版本。
对于 Xcode 8.3.2:
执行此操作后,我通过单击“目标”->“常规”->“签名”下“Xcode 托管配置文件”旁边的“i”信息图标,并确认“创建”日期反映了新日期,能够告诉 Xcode 正在使用最新的配置文件。
Most answers did not work for me as they seem to be for older versions.
For Xcode 8.3.2:
After doing this I was able to tell Xcode was using the latest profile by clicking the 'i' info icon next to "Xcode Managed Profile" under Targets->General->Signing and confirming that the 'Created' date reflected the new one.
就我而言,使用 XCode 5,当我的开发人员证书过期时,我遇到了这个问题。我手动下载了新证书和新的配置文件。我将证书添加到钥匙串,并将配置文件添加到管理器中的设备。
然而,XCode 一直抱怨我无法签署该应用程序。我发现在 XCode 5 首选项中,它仍然显示旧的配置文件,并且尽管我在那里进行了多次重新加载,但它并没有刷新到新的配置文件。
最终,我使用 iPhone 配置实用程序删除旧的配置文件并添加新下载的配置文件。代码签名按预期工作后。
In my case, with XCode 5, when my developer certificate expired, I ran into this issue. I manually downloaded the new certificate and new provisioning profile. I added the certificate to the keychain and the provisioning profile to the devices in organizer.
However, XCode kept complaining that I cannot sign the app. I figured that in XCode 5 preferences, it still displayed the old provisioning profile and it didn't refresh to the the new one despite numerous reloads that I did there.
Eventually, I used iPhone Configuration Utility to delete the old provisioning profile and add the newly downloaded provisioning profile. After code signing worked as expected.
我认为双击下载的配置文件会将其放入 xCode Organizer Archive 中,但这对我来说不起作用。以下步骤终于对我有用了。
I thought that double clicking on the downloaded provisioning profile would place it into xCode Organizer Archive, but that just wouldn't work for me. The following steps finally worked for me.
tl;dr: 事实证明,我只需手动编辑项目文件即可告诉 Xcode 新的配置文件。现在,我不知道为什么我必须手动更新项目文件。也许我在将新配置文件导入到 Xcode 的过程中做错了什么,所以它没有意识到我的新配置文件已经进来了。或者文件系统中途卡住了,Xcode 无法自行更新。那好吧。
现在是
有趣的技术部分:我查看了应用程序的
.xcodeproj
包的内容(Xcode 此时未运行)。要查看这些内容,请在 Finder 中打开项目文件夹,然后按住 Control 键单击.xcodeproj
文件并选择显示包内容:然后打开
project.pbxproj 在文本编辑器中(它是文本,而不是二进制),然后四处查找构建配置信息。
有一个标记为
/* Begin XCBuildConfiguration section */
的部分(您可以使用编辑器的搜索功能找到它)。它是一个条目列表,每个条目代表给定构建配置中给定配置文件的代码签名配置。以下是有关我用来签署二进制文件以进行开发的配置文件的信息:
值得注意的是这一行:
That's the GUID reporting by the build error;我的旧的、过期的配置文件的标识符。
我所要做的就是将其替换为新配置文件的 GUID:
我再次在 Xcode 中打开我的项目,现在我的应用程序使用新的配置文件成功构建并安装在我的设备上。
tl;dr: turns out I simply had to edit the project file manually to tell Xcode of the new profile. Now, I don't know why I had to manually update the project file. Perhaps I did something wrong during the process of importing the new profile to Xcode, so it didn't realize my new profile had come in. Or the file system choked midway and Xcode wasn't able to update itself. Oh well.
Now for the
funtechnical part:I peeked into the contents of my app's
.xcodeproj
bundle (Xcode is not running at this time). To view these, open your project folder in Finder, then Control-click on your.xcodeproj
file and choose Show Package Contents:Then opened
project.pbxproj
in a text editor (it's text, not binary), and looked around for build configuration information.There's a section labeled
/* Begin XCBuildConfiguration section */
(which you can find using your editor's search function). It's a list of entries, each of which represents a code-signing configuration for a given profile in a given build configuration.Here's information about the profile I use to sign my binary for development:
Of note is this line:
That's the GUID reported by the build error; the identifier of my old, expired provisioning profile.
All I had to do was replace it with the GUID of the new profile:
I open my project in Xcode again, and now my app builds and installs on my devices successfully, using the new provisioning profile.