xcode 找不到与应用程序标识符匹配的有效配置文件

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

A valid provisioning profile matching the application's identifier could not be found

xcodedeviceprovisioningportal

提问by chris P

This has been asked before, but the answers to previous questions are not solving my issue.

以前有人问过这个问题,但以前问题的答案并没有解决我的问题。

I'm trying to build a simple Hello World app called (CalculatorBrain) from Stanford iTunes U courses. I can run it in the Simulator fine, but I'd like to get it on my iPhone 4S.

我正在尝试从斯坦福 iTunes U 课程构建一个名为 (CalculatorBrain) 的简单 Hello World 应用程序。我可以在模拟器中很好地运行它,但我想在我的 iPhone 4S 上运行它。

I sync my iPhone 4S through iTunes on my Windows machine. Always have. Figured I should list this detail.

我通过 Windows 机器上的 iTunes 同步我的 iPhone 4S。一直有。想我应该列出这个细节。

Anyway, back to my Macbook (Mountain Lion). I'm running the most recent XCode 4.6.2 (4H1003) and my iPhone is also the most recent at 6.1.3 I believe.

无论如何,回到我的 Macbook(Mountain Lion)。我正在运行最新的 XCode 4.6.2 (4H1003),我相信我的 iPhone 也是最新的 6.1.3。

I went to the Provisioning Portal at the Apple developer page. I added my 4S. I called it JohnSmith, and gave it the phones UDID.

我去了 Apple 开发者页面的 Provisioning Portal。我加了我的4S。我称它为 JohnSmith,并给它手机 UDID。

In XCode, I opened the Organizer, Devices is highlighted by default. I put the passcode in my iPhone, and plugged it into my Macbook. Devices finds my iPhone. If I click on Provisioning Profiles and try 'Add Device to Provisioning Portal', I get a "A device with number already exists on this team." Great. I know it's added for sure then. All good news so far.

在 XCode 中,我打开了管理器,设备默认高亮显示。我把密码放在我的 iPhone 上,然后把它插到我的 Macbook 上。设备找到我的 iPhone。如果我单击配置文件并尝试“将设备添加到配置门户”,我会收到“此团队中已存在带有编号的设备”。伟大的。我知道它肯定会添加。到目前为止所有的好消息。

In my Hello World app, CalculatorBrain-Info.plist my Bundle Identifier is "com.JohnSmith.CalculatorBrain". Bundle display name is "${PRODUCT_NAME}" and executable file is "${EXECUTABLE_NAME}" if that matters.

在我的 Hello World 应用程序 CalculatorBrain-Info.plist 中,我的捆绑标识符是“com.JohnSmith.CalculatorBrain”。捆绑显示名称为“${PRODUCT_NAME}”,可执行文件为“${EXECUTABLE_NAME}”(如果重要的话)。

In the Navigator, if I highlight my project, and bring up the Build Settings, under Code Signing Identity I get the options...

在导航器中,如果我突出显示我的项目,并调出构建设置,在代码签名标识下,我会得到选项...

Don't Sign Code

不要签署代码

Automatic Profile Selector - iPhone Developer - iPhone Distribution

自动配置文件选择器 - iPhone 开发人员 - iPhone 分发

Identities without Provisioning Profiles - iPhone Developer: John Smith (R............K) - iPhone Distribution: John Smith (Y.............5)

没有配置文件的身份 - iPhone 开发人员:John Smith (R............K) - iPhone 分发:John Smith (Y.................5)

Other...

其他...

I've tried all of these. I'm assuming I'm supposed to use the iPhone Developer: John Smith one... but it's saying it's an identity without Provisioning Profiles.

我已经尝试了所有这些。我假设我应该使用 iPhone 开发人员:John Smith 一个......但它说这是一个没有配置文件的身份。

What's going on here? What do I need to do to get this to work?

这里发生了什么?我需要做什么才能让它发挥作用?

回答by Bryan Musial

Based on your description, it sounds like the missing element is that you need to go back to the 'Certificates, Identifiers, and Profiles' tool, generate a Development Provisioning Profile for the AppID of your HelloWorld app, then install that profile on your development machine. At a high level, this is composed of the following steps:

根据您的描述,听起来缺少的元素是您需要返回“证书、标识符和配置文件”工具,为您的 HelloWorld 应用程序的 AppID 生成开发配置配置文件,然后在您的开发中安装该配置文件机器。在高层次上,这由以下步骤组成:

  1. Locate the AppID for your project in Xcode.
  2. Verify that you've setup that AppID in 'Certificates, Identifiers, and Profiles'.
  3. Create a Development Provisioning Profile for that AppId, your development certificate, and one or more registered test devices.
  4. Download and Install the Provisioning Profile in Xcode.
  5. Configure your project to Code Sign using this Profile and Linked Code Signing Identity.
  6. Build to device!
  1. 在 Xcode 中找到您项目的 AppID。
  2. 验证您是否已在“证书、标识符和配置文件”中设置了该 AppID。
  3. 为该 AppId、您的开发证书和一个或多个注册的测试设备创建一个开发配置文件。
  4. 在 Xcode 中下载并安装 Provisioning Profile。
  5. 使用此配置文件和链接的代码签名标识将您的项目配置为代码签名。
  6. 构建到设备!

The 'Code Signing Identity' build configuration item you have mentioned is very much dependent on both your project's settings as well as the Provisioning Profiles available on your development machine. I recently answered a tangentially related question 'What are code signing identities?'that may be helpful in seeing what information Code Signing is using and how you can check that you've got your development machine setup to be able to Code Sign your project.

您提到的“代码签名身份”构建配置项在很大程度上取决于您的项目设置以及开发机器上可用的配置文件。我最近回答了一个相关的问题“什么是代码签名身份?” 这可能有助于查看代码签名正在使用哪些信息以及如何检查您的开发机器设置是否能够对您的项目进行代码签名。

...and now, on to more specific HOWTOs to help work through your Code Signing question:

...现在,更具体的 HOWTO 可以帮助您解决代码签名问题:

Locating Project's AppID

定位项目的 AppID

The AppID uniquely defines an application in the iOS ecosystem and is one of the things you first create when starting a new Xcode project. This AppID is what you need to register in the 'Certificates, Identifiers, and Profiles' tool to get started with Provisioning.

AppID 唯一定义了 iOS 生态系统中的应用程序,并且是您在启动新 Xcode 项目时首先创建的内容之一。您需要在“证书、标识符和配置文件”工具中注册此 AppID 才能开始配置。

Xcode AppId Setting

Xcode AppId 设置

  1. In the Project Navigator (CMD+1), click on your project name (likely 'CalculatorBrain'). This will present the project's settings.
  2. Select [Your Project Name] > Summary Tab as shown in the screen clipping from above (MyiOSApplication).
  3. Your iOS AppID is presented in the 'Bundle Identifier' field. Snag a copy of this string, you'll need it next.
  1. 在项目导航器 (CMD+1) 中,单击您的项目名称(可能是“CalculatorBrain”)。这将显示项目的设置。
  2. 选择 [您的项目名称] > 摘要选项卡,如上面的屏幕剪辑 (MyiOSApplication) 所示。
  3. 您的 iOS AppID 显示在“捆绑标识符”字段中。获取此字符串的副本,接下来您将需要它。

Verify (or Setup) the AppID

验证(或设置)AppID

  1. Navigate to http://developer.apple.com/iosand access the 'Certificates, Identifiers, and Profiles' tool.
  2. After logging in, select 'Identifiers'.
  3. Check that the AppID you found in the previous section is present in the list of App Identifiers. If so, take note of the App ID Name and skip to the next section, otherwise...
  4. Click the 'Add' (Plus) button in the upper right corner, provide a name for this App ID (can be whatever you want, just so long as it doesn't have special characters.)
  5. Scroll to the bottom of the page, and paste a copy of your App ID from the previous section in the 'Bundle ID' field. under 'Explicit App ID'.
  6. Click 'Continue'.
  1. 导航到http://developer.apple.com/ios并访问“证书、标识符和配置文件”工具。
  2. 登录后,选择“标识符”。
  3. 检查您在上一节中找到的 AppID 是否存在于 App Identifiers 列表中。如果是这样,请记下 App ID 名称并跳到下一部分,否则...
  4. 单击右上角的“添加”(加号)按钮,为此 App ID 提供一个名称(可以是任何您想要的名称,只要它没有特殊字符即可。)
  5. 滚动到页面底部,然后将上一部分中的 App ID 副本粘贴到“Bundle ID”字段中。在“显式应用程序 ID”下。
  6. 单击“继续”。

Do note that the AppID must be unique across the iOS Ecosystem -- you may get an error if the AppID you've selected is already in use. If so, change your 'Bundle ID' to something unique -- just be sure to update the 'Bundle ID' setting in your Xcode project to match whatever you settle on.

请注意,AppID 在 iOS 生态系统中必须是唯一的——如果您选择的 AppID 已被使用,您可能会收到错误消息。如果是这样,请将您的“Bundle ID”更改为唯一的 - 只需确保更新 Xcode 项目中的“Bundle ID”设置以匹配您选择的任何内容。

Creating a Development Provisioning Profile

创建开发配置文件

Now that the App ID is registered, you are now ready to create a Development Provisioning Profile linking your App ID, Development Certificate, and Test Device ID(s) together.

现在 App ID 已注册,您现在可以创建将您的 App ID、开发证书和测试设备 ID 链接在一起的开发供应配置文件。

  1. Within the 'Certificates, Identities, Profiles' tool, navigate to 'Provisioning Profiles'.
  2. Click on the 'Add' (Plus) button in the upper right corner.
  3. Select 'iOS App Development' in the 'Select Type' step and then click 'Continue'.
  4. Select your App ID from the drop down list of App IDs and then click 'Continue'.
  5. Check the box next to your Development Certificate and then click 'Continue'.
  6. Check the box next to the test device(s) you want to authorize to install this app and then click 'Continue'.
  7. Key in a Profile Name (again omitting special characters) then click 'Generate'.
  1. 在“证书、身份、配置文件”工具中,导航到“配置配置文件”。
  2. 单击右上角的“添加”(加号)按钮。
  3. 在“选择类型”步骤中选择“iOS App Development”,然后单击“继续”。
  4. 从 App ID 下拉列表中选择您的 App ID,然后单击“继续”。
  5. 选中您的开发证书旁边的框,然后单击“继续”。
  6. 选中您要授权安装此应用程序的测试设备旁边的框,然后单击“继续”。
  7. 键入配置文件名称(再次省略特殊字符),然后单击“生成”。

Download and Install Provisioning Profile

下载并安装配置文件

Once the Provisioning Profile is generated, the tool will provide you with a link to be able to download

生成配置文件后,该工具将为您提供一个链接以供下载

  1. Download the Provisioning Profile by clicking on the 'Download' link.
  2. Drag Provisioning Profile from your Download location and drop it on the Xcode Dock Icon or double-click to open it.
  1. 单击“下载”链接下载配置文件。
  2. 将 Provisioning Profile 从您的下载位置拖放到 Xcode Dock 图标上或双击打开它。

Configure Code Signing Identity

配置代码签名身份

Sounds like you already know where this is located, but just in case:

听起来您已经知道它的位置,但以防万一:

  1. In the Project Navigator (CMD+1), click on your project name (likely 'CalculatorBrain'). This will present the project's settings.
  2. Select [Your Project Name] > Build Settings Tab.
  3. Scroll to the 'Code Signing Identity' item.
  1. 在项目导航器 (CMD+1) 中,单击您的项目名称(可能是“CalculatorBrain”)。这将显示项目的设置。
  2. 选择 [您的项目名称] > 构建设置选项卡。
  3. 滚动到“代码签名身份”项。

In theory you would like to use the 'Automatic Profile Selector' option which will attempt to match your AppID to an installed Provisioning Profile, but you can also scroll through the list and pick a specific mapping of Bundle ID/AppId to iOS Certificate.

理论上,您希望使用“自动配置文件选择器”选项,该选项会尝试将您的 AppID 与已安装的配置文件匹配,但您也可以滚动列表并选择 Bundle ID/AppId 到 iOS 证书的特定映射。

Also, my own Xcode doesn't always seem to catch on to changes to freshly-installed provisioning profiles -- It is unclear if this is just a quirk of my own Xcode install or if there is a bug in Xcode. Either way, quitting and relaunching Xcode seems to trigger a reindex/refresh of profiles.

此外,我自己的 Xcode 似乎并不总是能适应新安装的配置文件的更改——目前尚不清楚这是否只是我自己的 Xcode 安装的一个怪癖,或者 Xcode 中是否存在错误。无论哪种方式,退出并重新启动 Xcode 似乎都会触发配置文件的重新索引/刷新。

Anyway, select the option that matches your AppId/BundleId and your Developer Certificate.

无论如何,选择与您的 AppId/BundleId 和您的开发人员证书相匹配的选项。

Assuming the problem was a missing/incomplete/expired Provisioning Profile, then this should help get you up and running. If not, we'll have to dig into other potential settings or certificates issues that could be tripping up your Code Signature operation.

假设问题是缺少/不完整/过期的配置文件,那么这应该可以帮助您启动并运行。如果没有,我们将不得不深入研究可能会阻碍您的代码签名操作的其他潜在设置或证书问题。

回答by Petri

I had very similar kind of problem, tried every option to those Code Signing's and the actual solution to mine was: - Restarted Xcode - Go to "Window->Organizer" - Then "Editor" and - "Refresh from Developer Portal" Then I just "Set the active scheme" to "iPhone (Petri)" on beside the Run and Stop buttons.

我遇到了非常相似的问题,尝试了这些代码签名的所有选项,我的实际解决方案是: - 重新启动 Xcode - 转到“窗口->组织者”-然后是“编辑器”和-“从开发人员门户刷新”然后我只需在运行和停止按钮旁边将活动方案设置为“iPhone (Petri)”即可。

回答by Asfanur

Please make sure Targets is checked instead of projects.

请确保选中目标而不是项目。

make sure Targets is selected

确保选择了目标

回答by Nikolay Shubenkov

enter image description hereIn my case device has 3 provision profiles of the same name. During development I updated provision profile a few times and every time new updated profile was added to device without removing the old one. So xcode searched first provision profile wich was wrong at that moment and throwed error in my face. So, what should you do:

在此处输入图片说明在我的情况下,设备有 3 个同名的配置文件。在开发过程中,我更新了几次配置文件,每次将新的更新配置文件添加到设备时都不会删除旧的。因此,xcode 搜索了当时错误的第一个配置文件,并在我面前抛出了错误。那你该怎么办:

  1. Open "Devices" window (Cmd + Shif + 2)
  2. Search for your Device and select It
  3. In the left bottom corner press on the "settings" button
  4. Press "Provision profiles"
  5. Search for dublicates. I found 3 items of profiles with the same name
  6. removed all but the latest one
  1. 打开“设备”窗口(Cmd + Shif + 2)
  2. 搜索您的设备并选择它
  3. 在左下角按“设置”按钮
  4. 按“配置文件”
  5. 搜索重复项。我找到了 3 个同名的个人资料
  6. 删除了除最新的之外的所有内容