Install .app file in simulator from the command line - command-line

How can I install a .app file in the simulator from the command line. Or do I need to install it from a .ipa file and how do I do that?

To run the app in the simulator you need a third party library like waxsim https://github.com/square/waxsim
You can setup their KIF library for acceptance tests
Then you can do a command line build and run it like this...
waxsim -f "ipad" "${MY_PATH}/MyApp.app" > $OUT_FILE 2>&1
Another option is to use the Frank libraries http://blog.thepete.net/blog/2012/06/24/writing-your-first-frank-test/ These are really easy to install and have a built in way to launch the simulator and run tests!

Related

how write iphone apps using objective-c from terminal

i would like to know how to develop iphone apps for terminal just like we do for android
by using the
android --target 1 --name someApp --package --com.someApp --activity main
command
how to do this for iphone apps
it should be like
iphone // then some options
or what is xcode or someother ide doing behind the scene ..??
If your question is "How do I develop from the terminal?", then, please, don't go there, but if you do:
The xcode project files are xml, they contain all information about your project, compile instructions, source files, resources, etc. You could create and manipulate these and use xcodebuild to compile your project.
If your question is 'How do I compile apps from the terminal?', then there are some valid reasons for doing so, automations, testing, etc. When you have installed Xcode, there are also some command line tools available, like xcodebuild. You can use these tools to build from the command line:
xcodebuild command line
Take a look at the xcoder ruby gem:
https://github.com/rayh/xcoder

How to run UIAutomation script from command line to Simulator

I have automated my iOS application using UIAutomation, To run this I launch iOS Instruments and run the script. If Same automation script I want to run to the device I use the below command which works as desired
instruments -w -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate myapp -e UIASCRIPT regression.js
But how do I run this from the command line to iOS Simulator ?
Please suggest.
Thanks
Sougata
If you don't supply the '-w' argument and build your app for the simulator sdk it should launch on the simulator.
In Xcode 6.0.1, running with the -w switch and passing in the symbolic name of the simulator appears to now be required (at least that's the only way I got it to work, and I've had others verify and point me to this solution).
See my answer from another post that has an explicit example.
You can also find a bash shell script that will handle invocation for you, automating the resolution of UDID and GUIDs in your simulator app paths.

How to install a .deb file on a jailbroken iphone programmatically?

I'm developing an app with Xcode for the iPhone (jailbroken). Now I want to install a .deb file programmatically. How can I do this? I could execute a command to install it, but how? Is it enough if I install my app via Xcode on my jailbroken iPhone? (.ipa) or do I need to create a .deb? If yes, how?
Thank you very much!
Have a nice day.
edit: I made a app. In this app I have a file browser (only for documents directory). In this directory there are .deb files. Now, I want to install these .deb files programmatically if the user taps on one. How do I go about this?
AFAIK dpkg -i *.deb is the command to install a .deb. But you cannot install a .deb in a .deb because the package manager is locked thus you need a script or something.
If you want your app to function as a package installer, then yes, I would use
dpkg -i filename.deb
You could execute this command programmatically with a system() call, or an exec() call, with "dpkg -i filename.deb" as the command. You might want to fully qualify the path to dpkg (e.g. /usr/bin/dpkg ... or whatever it is ... I'm not on my phone now) if you use system() especially.
It might be that you find that you need to have root privileges to do this. See this on how to give your app root privileges.
Another option, that doesn't require your app running as root or using exec() or system() calls, is to use the technique I describe in this answer, which was about how to reboot an iPhone programmatically. Just as I used a script to call the reboot command, you could write a script to execute dpkg -i filename.deb. You'd just need to come up with a mechanism to pass the filename to your script, which I assume would change dynamically (unless your program used a temporary link that always pointed to the current .deb file to be installed.)
Many options.
You can learn the source code of Cydia.( Official site provide source code)
Learn source code from Icy Github. https://github.com/ripdev/Icy
The simple way, just use system function to invoke dpkg command.
NSString *appsyncDebPath=#"/var/root/appsync.deb";
NSString *cmdString=[NSString stringWithFormat:#"/usr/bin/dpkg -i %# >/tmp/dpkg.log;",appsyncDebPath];
const char *cmdChar=[cmdString UTF8String];
system(cmdChar);
You may show result from /tmp/dpkg.log
AFAIK jailbreaking an iPhone let you install ipa without certificates... so it's enough...

Three20 JSON problem: Can deploy to simulator but not device (extThree20JSON)

Everything builds and runs in the simulator fine ... but when I attempt to run on device I get:
"arm-apple-darwin10-gcc-4.2.1:
..../three20/Build/Products/Debug-iphoneos/libextThree20JSON+YAJL.a:
No such file or directory"
I check that directory and indeed the file doesn't exist. It does exist in the "Debug-iphoneosimulator" though (which I guess explains why it works in the simulator).
So what gives and what can I do to correct this?
Thanks
This is fixed by adding the library via the python script from Three20. Do this in the command line:
python src/scripts/ttmodule.py -p ~/MyApp/MyApp.xcodeproj -c Debug -c Release extThree20JSON:extThree20JSON+SBJSON
OR
python src/scripts/ttmodule.py -p ~/MyApp/MyApp.xcodeproj -c Debug -c Release extThree20JSON:extThree20JSON+YAJL
depending on which library you need.
Are you building libextThree20JSON+YAJL.a from source, or did you just copy that .a file into your project? If the latter, the problem is probably that it is built for your computer's architecture (probably i386 or x86_64) and not ARM, what the iPhone/iPad use. To work on the device you need to either add the ARM-built version to your project, or add the library's source to your project so that it will automatically be built for the correct architecture with the rest of your code.
I switched from SBJSON to YAJL and for me a Clean Build Folder helped.

Is there a quick way to build & install to iPhone (from Xcode) without starting the app?

In Xcode, I can use CMD-R to run (or CMD-Y to debug), and my app will compile, install on the phone & start-up. (I've already prepped my phone & Xcode so this part works as expected.)
What I'd LIKE to do is type CMD-<something else> and have my program compile & install on the phone, but NOT start-up.
I realize that I can just CMD-B to build, then go through some rigamarole to deploy, but I'm hoping one of you smart-folk can tell me the lazy-man's shortcut for all of this.
Hey Olie, I haven't tried this because I don't have an iPhone to deploy to at the moment, but this /should/ work:
You can create a script which runs xcodebuild in your current project directory and give it the install target. Assuming you're going to want to debug at sometime, use the Debug configuration, otherwise use release. Then bind the script to some command key in the Xcode preferences and you should be on your way. To launch xcodebuild with debug you would do something like:
xcodebuild install -configuration Debug
If you have more than one target in your project you will have to specify that to xcodebuild as well:
xcodebuild install -target iPhoneApp -configuration Debug
You could also create a configuration specific to this scenario in your projects and pass that to xcodebuild and you should be able to script this in your favorite supported language (i.e., AppleScript, python, ruby, etc.).
HTH
I had the same question.
I ended up using the XCode Organizer. Select your current device. Summary Tab. "+" Applications..then select the one you just built (under /build/[debug|release]-iphoneos/.app
This does the install very easily.
Have you looked into using Automator? Here's a good write up on how to automate XCode to build and what not.
To build (exact flags documented under "man xcodebuild", install xcode's command line tools): xcodebuild build -sdk iphoneos6.0 workspace/project, targets, configs and/or scheme flags
To install (grab from github here then simply make and run): path/to/fruitstrap --id device-uuid-to-install-on --bundle path/to/ios.app