问题
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
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'
I have created a build.json
file in the root directory of the project with the following contents
{
"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.
I have XCode 8.3.2 installed, and I have logged in with my account in it in Preferences > Accounts, then I have clicked Download All Profiles.
EDIT: I am using Cordova CLI to build the app.
What am I doing wrong please?
回答1:
To build your Cordova app to an iPhone follow these steps:
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...
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.
From 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
- "Certificates > All" and then click on the "+" icon, and choose "iOS App Development".
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.
From Apple Developers
- 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.
From 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.
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
)
From Apple Developers
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>
.
From 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.
Under "Signing" choose your Team...
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/
{
"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
From 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.
回答2:
Stop XCode from automatically managing your signing. That option is in the general tab of the project settings in XCode.
After that, manually select the profile for debug and release inside XCode.
来源:https://stackoverflow.com/questions/43973856/cordova-error-65-when-trying-to-build-app-for-ios