问题描述
我的应用程序的开发配置文件已于几周前过期,因此我访问了配置门户以获取全新的配置。获得它后,我访问了Xcode Organizer,从我的设备和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.
问题是,当管理器能够看到新配置文件并安装它时正常情况下,IDE在旧的和新的之间混淆。每次我尝试构建应用程序时,它都会立即失败。错误控制台告诉我Xcode找不到旧的配置文件,因为列出的GUID属于旧配置文件。真奇怪;我认为Xcode现在已经知道了新的配置文件。
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.
我尝试从我的设备和Mac中删除新配置文件,然后重新安装配置文件。不起作用,Xcode仍然试图寻找旧的。我也试过选择一个不同的配置文件让Xcode忘记旧的,然后选择新的。我甚至尝试在其他选项中手动输入新GUID的GUID。然而,Xcode仍然坚持寻找旧的配置文件,现在它已经从我的Mac上消失了。
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.
我如何说服Xcode我已经生成了新的配置文件为我的应用程序使用?
How do I convince Xcode that I've generated a new provisioning profile for my app for it to use?
推荐答案
tl;博士:结果我只是不得不手动编辑项目文件以告诉Xcode新的配置文件。现在,我不知道为什么我必须手动更新项目文件。也许我在将新配置文件导入Xcode的过程中做错了,所以它没有意识到我的新配置文件已经进入。或者文件系统中途窒息而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.
现在为技术部分:
我偷看了我的应用程序的 .xcodeproj
包的内容(此时Xcode没有运行)。要查看这些,请在Finder中打开项目文件夹,然后按住Control键并单击 .xcodeproj
文件并选择显示包内容:
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:
Breeze.xcodeproj/
Daniel.mode1v3
Daniel.pbxuser
project.pbxproj
然后在文本编辑器(它的文本,而不是二进制文件)中打开 project.pbxproj
,并查看构建内容配置信息。
Then opened project.pbxproj
in a text editor (it's text, not binary), and looked around for build configuration information.
有一个标有 / * Begin XCBuildConfiguration部分* /
的部分(您可以使用编辑器找到它)搜索功能)。它是一个条目列表,每个条目代表给定构建配置中给定配置文件的代码签名配置。
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:
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Daniel Tan (XXXXXXXXXX)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Breeze_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42;
INFOPLIST_FILE = "Breeze-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PRODUCT_NAME = "Breeze";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "36F99F3E-805F-47A7-95D4-FF8324711CBE";
SDKROOT = iphoneos;
};
name = Debug;
};
注意这一行:
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "36F99F3E-805F-47A7-95D4-FF8324711CBE";
这是构建错误报告的GUID;我旧的,已过期的配置文件的标识符。
That's the GUID reported by the build error; the identifier of my old, expired provisioning profile.
我所要做的就是将其替换为新配置文件的GUID:
All I had to do was replace it with the GUID of the new profile:
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E6E6369E-FD58-4886-9C3A-72C9DAE36501";
我再次在Xcode中打开我的项目,现在我的应用程序在我的设备上成功构建并安装,使用新的配置文件。
I open my project in Xcode again, and now my app builds and installs on my devices successfully, using the new provisioning profile.
这篇关于Xcode无法识别我的新配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!