5

I am trying to create a simple project with last phonegap version:

$ phonegap create my-project
$ phonegap build ios
$ phonegap install ios

All works perfectly and I see emulator with my simple application.

But I can't find documentation on how to run my application on device(iphone, for example) and not on a simulator.

All documentation by cordova / phonegap based on examples with cordova's template for xcode. But last cordova's version don't have template for xcode and all that I need - cli, if I understand correctly?

I already registered as IOS developer and I have a valid iPhone development certificate. When I connect my device - I can see it in xcode and I can run native application on my device. But only via xcode.

I will be grateful to any advice.

3
  • See this link may be useful:1)gajotres.net/creating-phonegap-project-on-macos
    – Ved
    Jan 17, 2014 at 9:23
  • Thanks dude, but your example associated with xcode. Do you read my question before comment? Jan 19, 2014 at 0:18
  • Sorry to dig up an old post, but I was looking for this too. However, if your Cordova CLI is not generating an xcode project, that is something you might want to look into.
    – mix3d
    Jul 10, 2015 at 15:16

3 Answers 3

2

If the cordova app builds and runs on the simulator, try running cordova run ios --device

This worked for me, when before it was only hitting the simulator.

Alternatively, if that STILL doesn't work for you, when you run codova build ios, to just build the app, you could use itunes to sync the generated .app file in <project_folder>/platforms/ios/build/device/AppName.app

1
0

There is an Apple CLI tool canned xcodebuild, as well as this wrapper around it by Facebook. I'd suggest trying out either that or look at the build-in xcodebuild shipped with xcode.

Hopefully one of them will work.

1
  • The Cordova CLI already has a dependency on the xcodebuild CLI, which is how it is able to build an run on the emulator.
    – mix3d
    Jul 10, 2015 at 19:41
0

If you use Cordova CLI, you should be able to do this: cordova run ios

5
  • This doesnt help getting it directly onto the physical device... only runs the simulator.
    – mix3d
    Jul 10, 2015 at 15:18
  • You have to change the target in XCODE to real device and not the simulator.
    – Quintonn
    Jul 10, 2015 at 19:10
  • Right, but the point was NOT using xcode, using the CLI only. In xcode, the physical device is already specified, but running cordova run ios still opens the simulator.
    – mix3d
    Jul 10, 2015 at 19:40
  • 1
    You can try "cordova run ios --device" maybe
    – Quintonn
    Jul 11, 2015 at 7:40
  • Late response, but cordova run ios --device works like a charm. Awesome!
    – mix3d
    Aug 5, 2015 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.