[SOLVED] Cannot run on iOS device: ionic run ios --device fails


Hello everybody,

I want to run a project on iOS device rather than the simulator.

First of all my system information is:

Cordova CLI: 4.3.1
Gulp version:  CLI version 3.8.11
Gulp local:  
Ionic Version: 1.0.0
Ionic CLI Version: 1.5.5
Ionic App Lib Version: 0.2.2
ios-deploy version: 1.7.0 
ios-sim version: 3.1.1 
OS: Mac OS X Yosemite
Node Version: v0.10.35
Xcode version: Xcode 6.2 Build version 6C131e

When I execute ionic run ios --device I get the following error. It’s not so long, so, I’m pasting it all:

Running command: /Users/emre/sandbox/aykut/todo/hooks/after_prepare/010_add_platform_class.js /Users/emre/sandbox/aykut/todo
add to body class: platform-ios
Running command: /Users/emre/sandbox/aykut/todo/platforms/ios/cordova/run --device
Building project  : /Users/emre/sandbox/aykut/todo/platforms/ios/todo.xcodeproj
	Configuration : Debug
	Platform      : device
Build settings from command line:
    ARCHS = armv7 armv7s arm64
    CONFIGURATION_BUILD_DIR = /Users/emre/sandbox/aykut/todo/platforms/ios/build/device
    SDKROOT = iphoneos8.2
    SHARED_PRECOMPS_DIR = /Users/emre/sandbox/aykut/todo/platforms/ios/build/sharedpch
    VALID_ARCHS = armv7 armv7s arm64

Build settings from configuration file '/Users/emre/sandbox/aykut/todo/platforms/ios/cordova/build-debug.xcconfig':
    CODE_SIGN_IDENTITY = iPhone Developer


Check dependencies


Check dependencies
Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “(null)” were found.
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.2'


The following build commands failed:
	Check dependencies
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/emre/sandbox/aykut/todo/platforms/ios/cordova/build-debug.xcconfig,-project,todo.xcodeproj,ARCHS=armv7 armv7s arm64,-target,todo,-configuration,Debug,-sdk,iphoneos,build,VALID_ARCHS=armv7 armv7s arm64,CONFIGURATION_BUILD_DIR=/Users/emre/sandbox/aykut/todo/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/emre/sandbox/aykut/todo/platforms/ios/build/sharedpch
ERROR running one or more of the platforms: Error: /Users/emre/sandbox/aykut/todo/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project

Any help will be appreciated. Thanks.


the code signing keys are not configured in xcode. first do ionic build ios and then open the xcode project. In the general settings you need to add the keys.

Login using your apple developer credentials on apple developer portal and search for provisioning.

IOS is not like android. You need to sign the app and provision the device before running.


@gaurav_ch Thank you for pointing out the signing key problem. I solved the issue. Here are the steps I followed:

  1. run ionic platform remove ios
  2. open config.xml and edit the id attribute of the <widget> tag. (e.g. id=“com.mycompany.todo”)
  3. go to apple developer portal and register a new App ID (e.g. Name: todo, Bundle ID: com.mycompany.todo)
  4. in the apple developer portal create a provisioning profile for that app. I created a develoment profile.
  5. connect your iOS device to your computer via USB
  6. open the terminal and cd to the project’s root directory and run ionic platform add ios and then run ionic platform run ios --device

That’s all.

Note: Before following the steps above I opened the Xcode project located in platforms/ios/ and in the general settings sections I clicked a button like ‘fix code signing issues’. I don’t exactly remember what the label of the button was saying. But after clicking that, a popup window in Xcode appeared asking me to login to the developer center with my credentials. After establishing the connection it tried to import something but failed. Then I thought that I should create the app on the developer portal first. So, did I and it worked.