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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5291463/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:12:35  来源:igfitidea点击:

Xcode won't recognize my new provisioning profile

iphoneiosxcodeios-provisioningxcode-organizer

提问by BoltClock

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.

我的应用程序的开发配置文件在几周前过期,所以我去配置门户获取一个新的。获得它后,我访问了 Xcode Organizer,从我的设备和 Mac 中删除了过期的配置文件,然后导入了新的配置文件。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.

问题是,虽然 Organizer 能够看到新配置文件并正常安装,但 IDE 却在旧配置文件和新配置文件之间混淆。每次我尝试构建应用程序时,它都会立即失败。错误控制台告诉我 Xcode 找不到旧配置文件,因为列出的 GUID 属于旧配置文件。真奇怪; 我认为 Xcode 现在应该已经知道新的配置文件了。

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 Otherchoice. Yet Xcode still insists on looking for the old profile, which by now is already gone from my Mac.

我已尝试从我的设备和 Mac 中删除新配置文件,然后重新安装该配置文件。不起作用,Xcode 仍在尝试寻找旧的。我还尝试选择不同的配置文件让 Xcode 忘记旧的配置文件,然后选择新的配置文件。我什至尝试在其他选项中手动输入新的 GUID 。然而 Xcode 仍然坚持寻找旧的配置文件,现在它已经从我的 Mac 上消失了。

How do I convince Xcode that I've generated a new provisioning profile for my app for it to use?

我如何让 Xcode 相信我已经为我的应用程序生成了一个新的配置文件供它使用?

采纳答案by BoltClock

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 whyI 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.

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

Now for the funtechnical part:

现在对于 乐趣技术部分:

IMPORTANT:As with anything else that involves modifying files you shouldn't be modifying: make sure to back up your .xcodeprojbundle 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.

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

I peeked into the contents of my app's .xcodeprojbundle (Xcode is not running at this time). To view these, open your project folder in Finder, then Control-click on your .xcodeprojfile and choose Show Package Contents:

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

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

Then opened project.pbxprojin a text editor (it's text, not binary), and looked around for build configuration information.

然后project.pbxproj在文本编辑器中打开(它是文本,不是二进制),并环顾四周以获取构建配置信息。

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.

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

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.

那是构建错误报告的GUID;我旧的、过期的配置文件的标识符。

All I had to do was replace it with the GUID of the new profile:

我所要做的就是用新的配置文件的GUID替换它:

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

我再次在 Xcode 中打开我的项目,现在我的应用程序使用新的配置文件成功构建并安装在我的设备上。

回答by hackdev

Here's how I did it in Xcode 4:

这是我在 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
  1. 从 Project > Build Settings > Code Signing 中选择 Don't Code Sign
  2. 清理构建
  3. 再次构建它 - 应该显示“这个东西需要签名”之类的错误
  4. 从代码签名中选择新的配置文件
  5. 重建

回答by Tige Phillips

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.

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

回答by Axel Galan

  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
  1. 关闭 Xcode
  2. Edith 与 texmate, youtproject.xcodeproj
  3. 找到这一行 "PROVISIONING_PROFILE[sdk=iphoneos*]" = "E8DEEBA3-FE0A-419F-9F7E-258572D55807";
  4. 擦除
  5. 为企业重新启动 xcode 构建和存档

回答by Jonathan Fretheim

To add to the solution above, you can use the lovely xcodeprojgem 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

要添加到上面解决方案中,您可以使用可爱的xcodeprojgem 来帮助解决此类问题。请注意,它确实将您的 OpenStepkey = 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

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

这是我如何使用它的要点:https: //gist.github.com/82times/5594887

回答by Hodson

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

回答by lundhjem

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

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

For Xcode 8.3.2:

对于 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'
  1. Xcode->首选项->账户
  2. 选择 Apple ID
  3. 双击您的团队
  4. 单击左下角的“+”下拉菜单以“创建证书”
  5. 选择iOS开发
  6. 点击“完成”

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.

完成此操作后,我可以通过单击 Targets->General->Signing 下“Xcode Managed Profile”旁边的“i”信息图标并确认“Created”日期反映新的,来告诉 Xcode 正在使用最新的配置文件。

回答by Rajan Ponnappan

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.

就我而言,使用 XCode 5,当我的开发人员证书过期时,我遇到了这个问题。我手动下载了新证书和新配置文件。我将证书添加到钥匙串,并将配置文件添加到管理器中的设备。

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.

但是,XCode 一直抱怨我无法签署该应用程序。我认为在 XCode 5 首选项中,它仍然显示旧的配置文件,尽管我在那里进行了多次重新加载,但它没有刷新到新的配置文件。

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.

最后,我使用 iPhone 配置实用程序删除旧的配置文件并添加新下载的配置文件。代码签名按预期工作后。

回答by tyler.frankenstein

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.

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

  1. Open xCode
  2. Go to Product -> Destination -> iOS Device
  3. Go to Product -> Archive
  1. 打开 xCode
  2. 转到产品 -> 目的地 -> iOS 设备
  3. 转到产品 -> 存档