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
Cordova Error 65 when trying to build app for iOS
提问by Sartheris Stormhammer
I am trying to run my Cordova app on the connected iPhone, but everytime I try to do cordova run
I 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.json
file 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.chat
package 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
简答
- Run the command
cordova add platform ios
, which will create the XCode project file.xcworkspace
in your Cordova project directory under "platforms > ios" - From Xcode go to "File > Open" and find the
.xcworkspace
file under "platforms > ios" - Once the project is open, click on the blue project icon
to change the project settings.
- Under "Signing" choose your Team...
- 运行命令
cordova add platform ios
,这将.xcworkspace
在“平台 > ios”下的 Cordova 项目目录中创建 XCode 项目文件 - 从Xcode转到“文件>打开”并
.xcworkspace
在“平台> ios”下找到文件 - 项目打开后,单击蓝色项目图标
以更改项目设置。
- 在“签名”下选择您的团队...
Long answer
长答案
- Buy a Mac Book (https://www.apple.com/mac/)
- 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.
- 购买 Mac Book ( https://www.apple.com/mac/)
- 安装 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)
- Purchase a developer account for $99 through Apple
- Sign-in, and go to: https://developer.apple.com/account/ios/certificate/
- Create an "iOS development" certificate
- 通过 Apple 以 99 美元的价格购买开发者帐户
- 登录,然后访问:https: //developer.apple.com/account/ios/certificate/
- 创建“iOS 开发”证书
From KeyChain Access
从钥匙串访问
- Open the KeyChain Access app
Applications > Utilities > KeyChain Access
- Create a
CertificateSigningRequest.certSigningRequest
file, by going to "Certificate Assistant > Request a Certificate From a Certificate Authority", and upload that to Apple Developers.
- 打开钥匙串访问应用程序
Applications > Utilities > KeyChain Access
CertificateSigningRequest.certSigningRequest
通过转到“证书助手 > 从证书颁发机构请求证书”创建一个文件,然后将其上传到 Apple Developers。
From Apple Developers
来自 Apple 开发者
- 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.
- 注册您的 iPhone - 在“设备 > iPhone”下,单击“+”图标。
- 将要求提供设备“名称”和“uuid”
- 要获取设备 uuid,您需要从“iTunes”应用程序中获取。
From iTunes
来自 iTunes
- Plug your iPhone into your Mac Book with the USB power cable
- Open "iTunes" and click on the iPhone icon
- Click on the label "Serial Number:", this will reveal the UUID.
- Copy that UUID into the "uuid" field on the Apple Developers website.
- 使用 USB 电源线将 iPhone 插入 Mac Book
- 打开“iTunes”并点击iPhone图标
- 单击标签“序列号:”,这将显示 UUID。
- 将该 UUID 复制到 Apple Developers 网站上的“uuid”字段中。
From your command terminal
从您的命令终端
- Install Node (https://nodejs.org/en/download/) - macOS Installer
- Open the Terminal app
Applications > Utilities > Terminal
- Install Cordova:
sudo npm install -g cordova
(usesudo
) - Create a Cordova app, that follows the format:
cordova <app_directory> <bundle_id> <app_name>
- For example:
cordova gmail_app com.google.gmail Gmail
.
- Add a platform:
cordova platform add ios
(which will create.xcodeproj
)
- 安装节点 ( https://nodejs.org/en/download/) - macOS 安装程序
- 打开终端应用
Applications > Utilities > Terminal
- 安装 Cordova:(
sudo npm install -g cordova
使用sudo
) - 创建一个 Cordova 应用程序,遵循以下格式:
cordova <app_directory> <bundle_id> <app_name>
- 例如:
cordova gmail_app com.google.gmail Gmail
。
- 添加一个平台:(
cordova platform add ios
这将创建.xcodeproj
)
From Apple Developers
来自 Apple 开发者
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>
.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>
.
在“标识符”下创建一个新的“应用程序 ID”(单击“+”图标),并将“名称”字段设置为与您的 Cordova 应用程序同名
<app_name>
,并将包 ID 设置为与 Cordova 相同<bundle_id>
。在“Provisioning Profiles”下创建一个新的“iOS Development”配置文件,使用您的应用程序名称
<app_name>
并选择 bundle id<bundle_id>
。
From XCode
来自 XCode
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.
Open the Cordova Xcode project file:
- From XCode go to "File > Open" and find the
.xcworkspace
file under "platforms > ios" in your Cordova project.
- From XCode go to "File > Open" and find the
Once the project is open, click on the blue project icon
to change the project settings.
将您的 Apple ID 添加到 Xcode:
- 打开 XCode 并转到“Xcode > Preferences... > Accounts”并单击“+”图标以“Add Apple ID...”,然后输入您的苹果开发者帐户的用户名和密码。
打开 Cordova Xcode 项目文件:
- 从 XCode 转到“文件 > 打开”,然后
.xcworkspace
在 Cordova 项目中的“平台 > ios”下找到该文件。
- 从 XCode 转到“文件 > 打开”,然后
From your command terminal
从您的命令终端
- Create a
build.json
file in the root directory of your Cordova project:cd <app_directory>; touch build.json;
- Paste the following into your
build.json
file. - To get the "Team ID" you'll need to go to Apple Developers membership page: https://developer.apple.com/account/#/membership/
build.json
在 Cordova 项目的根目录中创建一个文件:cd <app_directory>; touch build.json;
- 将以下内容粘贴到您的
build.json
文件中。 - 要获得“团队 ID”,您需要访问 Apple Developers 会员页面:https: //developer.apple.com/account/#/membership/
{
"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"
}
}
}
- Next run
cordova build ios
, and it should build correctly
- 下一次运行
cordova build ios
,它应该正确构建
From XCode
来自 XCode
- 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.
- 最后...将 iPhone USB 数据线插入 Mac Book,确保选择了 (1) 设备,然后 (2) 单击运行按钮。这应该会将您使用 Cordova 构建的应用程序部署到 iPhone。
回答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 中手动选择用于调试和发布的配置文件。