Skip to content

Instantly share code, notes, and snippets.

@mohsin
Last active November 4, 2020 19:47
Show Gist options
  • Save mohsin/f6a2f16a5d708f350d929bde1ca7072e to your computer and use it in GitHub Desktop.
Save mohsin/f6a2f16a5d708f350d929bde1ca7072e to your computer and use it in GitHub Desktop.
Fetch iOS development team ID to run cordova ionic builds from the command line

To run builds in Cordova Ionic without having to generate the project and opening it in XCode and selecting it from command line:

  1. First run:
security find-identity -p codesigning -v

Command will return list of certificates such as: 13D6BF214D52A777C59114591DBBA36D875538F7 "Apple Development: [email protected] (2PZG12NNCV)"

  1. Fetch the correct required ID, by pasting in the selected certificate name as shown above:
security find-certificate -c "Apple Development: [email protected] (2PZG12NNCV)" -p | openssl x509 -subject

It will return the certificate but will start with: subject= /UID=SOMEUID/CN=Apple Development: [email protected] (2PZG12NNCV)/OU=4201ZNUA12/O=Saifur Rahman Mohsin/C=US The OU is the ID that is required i.e. 4201ZNUA12.

Create the build.json config file within the project as:

{
    "ios": {
        "debug": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "4201ZNUA12",
            "packageType": "development",
            "automaticProvisioning": true
        }
    }
}

Now the project can be run as ionic cordova run ios --debug

And you should be able to use it without any hassle.

(All Apple IDs, cert IDs, etc. in this gist are modified to garbage values. Numbers are just for representation.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment