xcode 尝试为 iOS 构建应用程序时出现 Cordova 错误 65

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

Cordova Error 65 when trying to build app for iOS

iosxcodecordovaprovisioning-profile

提问by Sartheris Stormhammer

I am trying to run my Cordova app on the connected iPhone, but everytime I try to do cordova runI am getting the following error

我试图在连接的 iPhone 上运行我的 Cordova 应用程序,但每次我尝试这样做时,cordova run我都会收到以下错误

Check dependencies

No profiles for 'com.myapp.chat' were found: Xcode couldn't find a provisioning profile matching 'com.myapp.chat'. Code signing is required for product type 'Application' in SDK 'iOS 10.3'

检查依赖项

找不到“com.myapp.chat”的配置文件:Xcode 找不到与“com.myapp.chat”匹配的配置文件。SDK“iOS 10.3”中的产品类型“应用程序”需要代码签名

I have created a build.jsonfile in the root directory of the project with the following contents

build.json在项目的根目录下创建了一个文件,内容如下

{
  "ios": {
    "debug": {
      "developmentTeam": "some_id_here"
    },

    "release": {
      "developmentTeam": "some_id_here",
      "codeSignIdentity": "My App",
      "packageType": "ad-hoc"
    }
  }
}

The ID of the profile is correct, I have downloaded it from the developer support page, the com.myapp.chatpackage name is also registered on that provisioning profile.

配置文件的 ID 是正确的,我是从开发人员支持页面下载的,com.myapp.chat包名称也在该配置文件中注册。

I have XCode 8.3.2installed, and I have logged in with my account in it in Preferences > Accounts, then I have clicked Download All Profiles.

我安装了XCode 8.3.2,并在“首选项”>“帐户”中使用我的帐户登录,然后单击“下载所有配置文件”。

EDIT: I am using Cordova CLI to build the app.

编辑:我使用 Cordova CLI 来构建应用程序。

What am I doing wrong please?

请问我做错了什么?

回答by tfmontague

To build your Cordova app to an iPhone follow these steps:

要将 Cordova 应用程序构建到 iPhone,请执行以下步骤:

Short Answer

简答

  1. Run the command cordova add platform ios, which will create the XCode project file .xcworkspacein your Cordova project directory under "platforms > ios"
  2. From Xcode go to "File > Open" and find the .xcworkspacefile under "platforms > ios"
  3. Once the project is open, click on the blue project icon project iconto change the project settings.
  4. Under "Signing" choose your Team...signing
  1. 运行命令cordova add platform ios,这将.xcworkspace在“平台 > ios”下的 Cordova 项目目录中创建 XCode 项目文件
  2. 从Xcode转到“文件>打开”并.xcworkspace在“平台> ios”下找到文件
  3. 项目打开后,单击蓝色项目图标项目图标以更改项目设置。
  4. 在“签名”下选择您的团队...签字

Long answer

长答案

  1. Buy a Mac Book (https://www.apple.com/mac/)
  2. Install Xcode (https://developer.apple.com/xcode/)
    • This will create a certificate authority "Apple Worldwide Developer Relations Certification Authority" which is needed by KeyChain Access.
  1. 购买 Mac Book ( https://www.apple.com/mac/)
  2. 安装 Xcode ( https://developer.apple.com/xcode/)
    • 这将创建 KeyChain Access 所需的证书颁发机构“Apple Worldwide Developer Relations Certification Authority”。

From Apple Developers (developer.apple.com)

来自 Apple Developers ( developer.apple.com)

  1. Purchase a developer account for $99 through Apple
  2. Sign-in, and go to: https://developer.apple.com/account/ios/certificate/
  3. Create an "iOS development" certificate
    • "Certificates > All" and then click on the "+" icon, and choose "iOS App Development". create_ios_development_certificate
  1. 通过 Apple 以 99 美元的价格购买开发者帐户
  2. 登录,然后访问:https: //developer.apple.com/account/ios/certificate/
  3. 创建“iOS 开发”证书
    • “Certificates > All”,然后点击“+”图标,选择“iOS App Development”。 create_ios_development_certificate

From KeyChain Access

从钥匙串访问

  1. Open the KeyChain Access app Applications > Utilities > KeyChain Access
  2. Create a CertificateSigningRequest.certSigningRequestfile, by going to "Certificate Assistant > Request a Certificate From a Certificate Authority", and upload that to Apple Developers.
  1. 打开钥匙串访问应用程序 Applications > Utilities > KeyChain Access
  2. CertificateSigningRequest.certSigningRequest通过转到“证书助手 > 从证书颁发机构请求证书”创建一个文件,然后将其上传到 Apple Developers。

From Apple Developers

来自 Apple 开发者

  1. Register your iPhone - under "Devices > iPhone", click on the "+" icon.
    • Will ask for a device "name" and the "uuid"
    • To get the device uuid, you'll need to get it from the "iTunes" app.
  1. 注册您的 iPhone - 在“设备 > iPhone”下,单击“+”图标。
    • 将要求提供设备“名称”和“uuid”
    • 要获取设备 uuid,您需要从“iTunes”应用程序中获取。

From iTunes

来自 iTunes

  1. Plug your iPhone into your Mac Book with the USB power cable
  2. Open "iTunes" and click on the iPhone iconiTunes iPhone icon
  3. Click on the label "Serial Number:", this will reveal the UUID.
  4. Copy that UUID into the "uuid" field on the Apple Developers website.
  1. 使用 USB 电源线将 iPhone 插入 Mac Book
  2. 打开“iTunes”并点击iPhone图标iTunes iPhone 图标
  3. 单击标签“序列号:”,这将显示 UUID。
  4. 将该 UUID 复制到 Apple Developers 网站上的“uuid”字段中。

From your command terminal

从您的命令终端

  1. Install Node (https://nodejs.org/en/download/) - macOS Installer
  2. Open the Terminal app Applications > Utilities > Terminal
  3. Install Cordova: sudo npm install -g cordova(use sudo)
  4. Create a Cordova app, that follows the format:
    • cordova <app_directory> <bundle_id> <app_name>
    • For example: cordova gmail_app com.google.gmail Gmail.
  5. Add a platform: cordova platform add ios(which will create .xcodeproj)
  1. 安装节点 ( https://nodejs.org/en/download/) - macOS 安装程序
  2. 打开终端应用 Applications > Utilities > Terminal
  3. 安装 Cordova:(sudo npm install -g cordova使用sudo
  4. 创建一个 Cordova 应用程序,遵循以下格式:
    • cordova <app_directory> <bundle_id> <app_name>
    • 例如:cordova gmail_app com.google.gmail Gmail
  5. 添加一个平台:(cordova platform add ios这将创建.xcodeproj

From Apple Developers

来自 Apple 开发者

  1. Under "Identifiers" create a new "App Id" (click on the "+" icon), and set the "name" field with the same name as your Cordova app <app_name>, and the bundle ID with the same as the Cordova <bundle_id>.

  2. Under "Provisioning Profiles" create a new "iOS Development" provisioning profile, with the name of your app <app_name>and select the bundle id <bundle_id>.

  1. 在“标识符”下创建一个新的“应用程序 ID”(单击“+”图标),并将“名称”字段设置为与您的 Cordova 应用程序同名<app_name>,并将包 ID 设置为与 Cordova 相同<bundle_id>

  2. 在“Provisioning Profiles”下创建一个新的“iOS Development”配置文件,使用您的应用程序名称<app_name>并选择 bundle id <bundle_id>

From XCode

来自 XCode

  1. Add your Apple ID to Xcode:

    • Open XCode and go to "Xcode > Preferences... > Accounts" and click on the "+" icon to "Add Apple ID..." and then enter your user name and password for your apple developers account.
  2. Open the Cordova Xcode project file:

    • From XCode go to "File > Open" and find the .xcworkspacefile under "platforms > ios" in your Cordova project.
  3. Once the project is open, click on the blue project icon project iconto change the project settings.

  4. Under "Signing" choose your Team...signing

  1. 将您的 Apple ID 添加到 Xcode:

    • 打开 XCode 并转到“Xcode > Preferences... > Accounts”并单击“+”图标以“Add Apple ID...”,然后输入您的苹果开发者帐户的用户名和密码。
  2. 打开 Cordova Xcode 项目文件:

    • 从 XCode 转到“文件 > 打开”,然后.xcworkspace在 Cordova 项目中的“平台 > ios”下找到该文件。
  3. 项目打开后,单击蓝色项目图标项目图标以更改项目设置。

  4. 在“签名”下选择您的团队...签字

From your command terminal

从您的命令终端

  1. Create a build.jsonfile in the root directory of your Cordova project:
  1. build.json在 Cordova 项目的根目录中创建一个文件:

{ "ios": { "debug": { "codeSignIdentity": "iPhone Developer", "developmentTeam": "<Team ID>", "packageType": "development" }, "release": { "codeSignIdentity": "iPhone Developer", "developmentTeam": "<Team ID>", "packageType": "app-store" } } }

{ "ios": { "debug": { "codeSignIdentity": "iPhone Developer", "developmentTeam": "<Team ID>", "packageType": "development" }, "release": { "codeSignIdentity": "iPhone Developer", "developmentTeam": "<Team ID>", "packageType": "app-store" } } }

  1. Next run cordova build ios, and it should build correctly
  1. 下一次运行cordova build ios,它应该正确构建

From XCode

来自 XCode

  1. Finally... with your iPhone USB cable plugged into your Mac Book, make sure your (1) device is selected, and (2) click the run button. This should deploy the app you built with Cordova to the iPhone.
  1. 最后...将 iPhone USB 数据线插入 Mac Book,确保选择了 (1) 设备,然后 (2) 单击运行按钮。这应该会将您使用 Cordova 构建的应用程序部署到 iPhone。

xcode

代码

回答by Abhishek Jain

Stop XCode from automatically managing your signing. That option is in the general tab of the project settings in XCode.

阻止 XCode 自动管理您的签名。该选项位于 XCode 项目设置的常规选项卡中。

After that, manually select the profile for debug and release inside XCode.

之后,在 XCode 中手动选择用于调试和发布的配置文件。