问题
I'm developing apps for jailbroken iPhone on Xcode. I'm using Xcode 4.2 and my iPhone OS is iOS6. I cannot connect my iPhone with XCode for testing because XCode 4.2 does not support iOS6.
Every time when I compile the code and try to run it on the simulator, I cannot get out of the sandbox. So I've tried to create an .ipa file, install it on iPhone and test it.
Is there any way to test jail broken apps on simulator?
回答1:
It depends what kind of jailbreak functionality you're looking to test. I have a jailbreak app that accesses the full file system, and when I run it in the Simulator, I can access ALL the files on my Mac, not just from the Simulator's home directory (See pic here showing the Mac's Applications directory in Simulator). If this is something you have in your app, you could reconstruct the file system of your iPhone on your Mac and use that for testing. However, if you're doing something like accessing the iPhone's serial port, the Simulator obviously won't have that capability.
Alternatively, have you tried creating a post build script to install the .app file onto your iPhone via SSH? Here's the script I use (the variable IPOD
is the device's IP local address in my WLAN, the others come from Xcode):
bundleid=`defaults read $BUILT_PRODUCTS_DIR/${WRAPPER_NAME}/Info.plist CFBundleIdentifier`
# kill if running, remove old version, copy new one and launch it
ssh -p $PORT root@$IPOD "killall $EXECUTABLE_NAME"
ssh -p $PORT root@$IPOD "rm -r /private/var/stash/Applications/$WRAPPER_NAME"
scp -P $PORT -r $BUILT_PRODUCTS_DIR/${WRAPPER_NAME} root@$IPOD://private/var/stash/Applications
ssh -p $PORT root@$IPOD "open $bundleid"
The open
command is available on Cydia.
This is obviously a very simple script and there are probably better ways of doing it (like using dpkg
), but it gets the job done for me.
You'll obviously need to have SSH installed and activated on your iPhone, and some other things like killall
(all available in Cydia).
来源:https://stackoverflow.com/questions/13677803/jailbroke-app-on-simulator