Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Error 65 when trying to build app for iOS

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?

like image 241
Sartheris Stormhammer Avatar asked May 15 '17 07:05

Sartheris Stormhammer


1 Answers

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

Short Answer

  1. Run the command cordova add platform ios, which will create the Xcode project file .xcworkspace in your Cordova project directory under "platforms > ios"
  2. From Xcode go to "File > Open" and find the .xcworkspace file under "platforms > ios"
  3. Once the project is open, click on the blue project icon project icon to change the project settings.
  4. Under "Signing" choose your Team...signing

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.

From 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

From KeyChain Access

  1. Open the KeyChain Access app Applications > Utilities > KeyChain Access
  2. 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

  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.

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

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.
  1. Add a platform: cordova platform add ios (which will create .xcodeproj)

From Apple Developers

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

From 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.
  1. Open the Cordova Xcode project file:
  • From Xcode go to "File > Open" and find the .xcworkspace file under "platforms > ios" in your Cordova project.
  1. Once the project is open, click on the blue project icon project icon to change the project settings.

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

From your command terminal

  1. 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"
    }
  }
}
  1. Next run cordova build ios, and it should build correctly

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

xcode

like image 94
tim-montague Avatar answered Sep 19 '22 09:09

tim-montague