Cordova build ios error

As using Cordova to build an app for Ios, after adding ios platform into your current project cordova platform add ios and you got this error

// Run Ios emulator
cordova run ios --device

CordovaError: Promise rejected with non-error: "xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance\n"
    at /usr/local/lib/node_modules/cordova/bin/cordova:29:15
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Here are my solution

  1. brew install gcc
  2. xcode-select --install
  3. xcode-select --switch /Applications/Xcode.app

If you got

cordova run ios --device                          
CordovaError: Promise rejected with non-error: "ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/ios-control/ios-deploy into your path, or do 'npm install -g ios-deploy'"
    at /usr/local/lib/node_modules/cordova/bin/cordova:29:15
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Solution

sudo npm install -g ios-deploy --unsafe-perm=true

References:

  1. https://stackoverflow.com/questions/39524148/xcode-error-code-signing-is-required-for-product-type-application-in-sdk-ios