dhemery / victor

A Java driver for iOS applications
MIT License
11 stars 4 forks source link

Launching simulator wiothout opening the xcode #21

Open rohitkothari85 opened 11 years ago

rohitkothari85 commented 11 years ago

Hi Right now I am using applescript to invoke and click run button in Xcode. Though applescript are not reliable, I am looking for some terminal command, which will help me to invoke simulator. Is there a clean method to invoke the Simulator directly.

dhemery commented 11 years ago

Here is the command line:

path-to-simulator -currentSDKRoot path-to-sdk-root -SimulateDevice device-type -SimulateApplication path-to-application-executable

_path-to-simulator_ is the path to the simulator application. On my computer, it is:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator

_path-to-sdk-root_ is the path to whatever version of the simulator SDK you want to use. For example, this is the path to the iOS Simulator 6.1 SDK on my computer:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk

_device-type_ is a string that indicates what device you want to simulate. You can use any of the strings in the iOS simulator's Hardware > Device menu. The legal values on my computer (iOS 6.1 SDK) are:

_path-to-application-executable_ is the path to your application's executable file. This will be a file inside your application bundle. For my Vigor application, the path is:

/Users/xxx/Library/Developer/Xcode/DerivedData/vigor-cmmkrmgawvklxjawwklnncgjxwge/Build/Products/Debug-iphoneos/Vigor.app/Vigor

rohitkothari85 commented 11 years ago

Hi Dale

I got all the path that you have specified, but not the path-to-application-executable. I am using frankified version of the application for testing. So I am getting XXXfrankified.build folder inside that I am getting .hmap file of the application. And once I get the completed path, then I just need to run it in the console to invoke my application. Am I right ??

rohitkothari85 commented 11 years ago

And thanks for your quick and helpful reply. I appreciate your help.

dhemery commented 11 years ago

Inside my frankfied_build folder I have Frankified.app. Inside Frankfied.app is an executable file called Vigor. Your Frankified.app will have a different executable inside it. That is the executable you need to find.

Then you must find the entire path to that file.

You must pass that path as a parameter to the simulator. To run the simulator, you have to run this whole thing as a single command:

path-to-simulator -currentSDKRoot path-to-sdk-root -SimulateDevice device-type -SimulateApplication path-to-application-executable

That whole thing is one command. You have to run the whole thing. When you supply the paths and other parameters, it's a very long command, like this:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -currentSDKRoot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -SimulateDevice "iPhone (Retina 4-inch)" -SimulateApplication /Users/xxx/Projects/Vigor/frankified_build/Frankified.app/Vigor

rohitkothari85 commented 11 years ago

Hi Dale

I am able to open the application inside simulator without opening the Xcode. I am using the above mentioned steps by you.

I am having one problem, When I open the simulator using the above URL in terminal. I am getting the simulator open with the app and the terminal is block till the time, simulator is open. So my code is not executed because of this deadlock.

Do we have some other mechanism where, I can open the simulator with the app, without blocking the terminal, without opening the Xcode. That would serve my testing purpose.

-Thanks Rohit

rohitkothari85 commented 11 years ago

Hi Dale,

Whats your thought on the above query?

-Rohit

dhemery commented 11 years ago

Two possibilities I can think of:

  1. Run the launch command in one terminal window, and open another one to do whatever else you want to do.
  2. Run the launch command in the background by adding & at the end of the line.