Xcode 无法识别我的新配置文件

发布于 2024-10-21 14:09:24 字数 530 浏览 6 评论 0原文

我的应用程序的开发配置文件已在几周前过期,因此我前往配置门户获取全新的配置文件。获得它后,我访问了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

昔梦 2024-10-28 14:09:25

以下是我在 Xcode 4 中的做法:

  1. 选择 Don't Code Sign from Project >构建设置>代码签名
  2. 清理构建
  3. 再次构建 - 应该显示类似“这个东西需要签名”的错误
  4. 从代码签名
  5. 重建中选择新的配置文件

Here's how I did it in Xcode 4:

  1. Select Don't Code Sign from Project > Build Settings > Code Signing
  2. Clean the build
  3. Build it again - should show an error like "this stuff needs signing"
  4. Choose the new profile from the Code Signing
  5. Rebuild
平生欢 2024-10-28 14:09:25

我可以通过在代码签名身份中将其更改为“不要代码签名”来修复此错误。构建时,您会收到错误“产品类型需要代码签名......等等......”。然后返回并选择正确的配置文件。构建一切都很好。这发生在我身上,因为我的证书过期了,我更新了它。除了上述内容之外,我还必须从我的钥匙串和组织者中删除旧证书。

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.

悟红尘 2024-10-28 14:09:25
  1. 用 texmate关闭 de xcode
  2. edith,youtproject.xcodeproj
  3. 找到这一行 "PROVISIONING_PROFILE[sdk=iphoneos*]" = "E8DEEBA3-FE0A-419F-9F7E-258572D55807";
  4. 擦除
  5. 重新启动 xcode build &企业档案
  1. Close de xcode
  2. edith with texmate, youtproject.xcodeproj
  3. Find this line "PROVISIONING_PROFILE[sdk=iphoneos*]" = "E8DEEBA3-FE0A-419F-9F7E-258572D55807";
  4. Erase
  5. Restart xcode build & archive for enterprise
醉梦枕江山 2024-10-28 14:09:25

要添加到上面的解决方案,您可以使用可爱的xcodeproj gem 可以帮助解决此类问题。请注意,它确实会将 OpenStep key = value; 样式的 plist 转换为 XML。注意:我发现如果您稍后在 Xcode 中更改项目文件,Xcode 会将其更改回来。无论是在 Xcode 中还是从命令行中,这两种类型的文件都可以很好地构建。有关我如何使用它的示例,

project = Xcodeproj::Project.new('Foo.xcodeproj')
csi_key = 'CODE_SIGNING_IDEDNTITY'
project.targets.each do |target|
  target.build_configurations.each do |conf|
    conf.build_settings[csi_key] = 'iPhone Developer: Cool Dood (XYZ123)' unless conf.build_settings[csi_key] == nil
  end
end

以下是我如何使用它的要点: 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 it

project = Xcodeproj::Project.new('Foo.xcodeproj')
csi_key = 'CODE_SIGNING_IDEDNTITY'
project.targets.each do |target|
  target.build_configurations.each do |conf|
    conf.build_settings[csi_key] = 'iPhone Developer: Cool Dood (XYZ123)' unless conf.build_settings[csi_key] == nil
  end
end

Here's a gist of how I use it: https://gist.github.com/82times/5594887

抚笙 2024-10-28 14:09:25

我对此问题的解决方案是:

  1. 下载新的配置文件
  2. 双击配置文件进行安装
  3. 转到 Mac 上的以下目录:
    /Users//Library/MobileDevice/Provisioning Profiles
  4. 找到您不再需要的旧配置文件(但一直显示在 Xcode 中)。这对于此步骤可能会派上用场: https://github.com/chockenberry/Provisioning
  5. 删除它
  6. 完全 退出 Xcode
  7. 重新打开 Xcode
  8. 您现在应该能够选择新的配置文件

My solution to this problem was:

  1. Download your new provisioning profile
  2. Double click the provisioning profile to install it
  3. Go to the following directory on your mac:
    /Users/<your.username>/Library/MobileDevice/Provisioning Profiles
  4. Find the old provisioning profile that you no longer want (but keeps showing up in Xcode). This may come in handy for this step: https://github.com/chockenberry/Provisioning
  5. Delete it
  6. Completely exit Xcode
  7. Reopen Xcode
  8. You should now be able to select your new provisioning profile
花想c 2024-10-28 14:09:25

大多数答案对我不起作用,因为它们似乎适用于旧版本。

对于 Xcode 8.3.2:

  1. Xcode-> 首选项-> 帐户
  2. 选择 Apple ID
  3. 双击您的团队
  4. 单击左下角的“+”下拉列表以“创建证书”
  5. 选择 iOS 开发
  6. 单击“完成”

执行此操作后,我通过单击“目标”->“常规”->“签名”下“Xcode 托管配置文件”旁边的“i”信息图标,并确认“创建”日期反映了新日期,能够告诉 Xcode 正在使用最新的配置文件。

Most answers did not work for me as they seem to be for older versions.

For Xcode 8.3.2:

  1. Xcode->Preferences->Accounts
  2. Select Apple ID
  3. Double-click your Team
  4. Click the '+' dropdown in the bottom left to "Create a certificate"
  5. Choose iOS Development
  6. Click 'Done'

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.

梦魇绽荼蘼 2024-10-28 14:09:25

就我而言,使用 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.

等待我真够勒 2024-10-28 14:09:25

我认为双击下载的配置文件会将其放入 xCode Organizer Archive 中,但这对我来说不起作用。以下步骤终于对我有用了。

  1. 打开 xCode
  2. 转到产品 ->目的地-> iOS 设备
  3. 前往产品 ->档案

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.

  1. Open xCode
  2. Go to Product -> Destination -> iOS Device
  3. Go to Product -> Archive
各自安好 2024-10-28 14:09:24

tl;dr: 事实证明,我只需手动编辑项目文件即可告诉 Xcode 新的配置文件。现在,我不知道为什么我必须手动更新项目文件。也许我在将新配置文件导入到 Xcode 的过程中做错了什么,所以它没有意识到我的新配置文件已经进来了。或者文件系统中途卡住了,Xcode 无法自行更新。那好吧。

现在是有趣的技术部分:

重要提示:与涉及修改您不应该修改的文件的任何其他操作一样:确保备份您的 .xcodeproj 捆绑包和/或您的整个 Xcode 项目,或者确保您的 Xcode 项目处于正确的版本控制中。您不想搞砸并导致 Xcode 停止在您的设备上构建您的项目,而没有任何可以依靠的东西。

我查看了应用程序的 .xcodeproj 包的内容(Xcode 此时未运行)。要查看这些内容,请在 Finder 中打开项目文件夹,然后按住 Control 键单击 .xcodeproj 文件并选择显示包内容

Breeze.xcodeproj/
  Daniel.mode1v3
  Daniel.pbxuser
  project.pbxproj

然后打开 project.pbxproj 在文本编辑器中(它是文本,而不是二进制),然后四处查找构建配置信息。

有一个标记为 /* Begin XCBuildConfiguration section */ 的部分(您可以使用编辑器的搜索功能找到它)。它是一个条目列表,每个条目代表给定构建配置中给定配置文件的代码签名配置。

以下是有关我用来签署二进制文件以进行开发的配置文件的信息:

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";

That's the GUID reporting by the build error;我的旧的、过期的配置文件的标识符。

我所要做的就是将其替换为新配置文件的 GUID:

"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E6E6369E-FD58-4886-9C3A-72C9DAE36501";

我再次在 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 fun technical part:

IMPORTANT: As with anything else that involves modifying files you shouldn't be modifying: make sure to back up your .xcodeproj bundle and/or your entire Xcode project, or make sure your Xcode project is kept in proper version control. You don't want to mess up and cause Xcode to stop building your project onto your device, without anything to fall back on.

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

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:

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;
};

Of note is this line:

"PROVISIONING_PROFILE[sdk=iphoneos*]" = "36F99F3E-805F-47A7-95D4-FF8324711CBE";

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:

"PROVISIONING_PROFILE[sdk=iphoneos*]" = "E6E6369E-FD58-4886-9C3A-72C9DAE36501";

I open my project in Xcode again, and now my app builds and installs on my devices successfully, using the new provisioning profile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文