jailbroke app on simulator? - xcode

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?

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).

Related

programmatically xcode build(ios library) -is it possible?

I have mac descktop app(flutter, small obfuscator for objective-c code). after obfuscation of the source code, the user builds a ios library in XCode. is it possible to start the build process from my application?
These my options are:
Xcode Command Line Tools - it's very similar, but looks a bit complicated.
Also, I don't know yet how to use the terminal (terminal commands) in the desktop application - is it even possible?
fastlane -this tool is more for deployment. can i use this to build locally?
What do you recommend? maybe there are other options?
read below documentaion and set flutter path so it can be runable in terminal or you can get help from youtube to set flutter path
then simply open terminal and run below comands one by one
1.open -a simulator
this command open ios emulator
write cd and drag your project folder path
cd .../example
flutter run
✅your app launch in emulator
flutter path set details
https://docs.flutter.dev/get-started/install/macos

XCode - How to reset/"delete" a mac os app run from Xcode (analog to deleting the app in the ios simulator)?

When using the iOS Simulator, I can simply delete the app and re-run the app to start fresh. How is this done for mac os apps? I can't find it out. There is a folder for the project inside "DerivedData", but deleting this also messes with the entire project and I have to re-fetch all dependencies and stuff.
Thanks!
Had the same question, found the answer in another question on Stack Overflow: Nicolas Miari and superfell's answer did the trick for me and my Mac Catalyst app:
You can use the defaults command line tool to remove all the settings,
you just need the bundle id of your app (which you can find in your
Info.plist file), e.g. if your bundle id is "com.foo.barApp" then you
can run this from a terminal shell:
defaults delete com.foo.barApp
For anyone who comes here later for solution:
install fd from homebrew: brew install fd
search for your data folder: fd com.thisIsYour.bundleId
You should see something likes this:
Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...
Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...
Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...
remove the folder: rm -rf Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD
If the app is storing something at say ~/Library/Caches/yourapp or ~/Library/Application Support/yourapp, it's trivial to set up an Automator Service, or bash alias to clean them up.
~/Library/Developer/Xcode/DerivedData is meant for the Xcode project and the things Xcode creates, not the things that your app creates such as user preferences.
Alternatively, you can create a listener for a flag in the app itself like --run-fresh that can be set in scheme settings as launch argument. This flag will (if you code it) stop the app from looking into user data folder.

Failed to launch macOS app built in Xcode

I've built an App in Xcode in release mode. Is signed with valid Developer ID certificate. And the app launches fine on some MacBooks.
But on another launch fails with error
The application %name% can't be opened.
Then I try to launch it from terminal with open command it says
LSOpenURLsWithRole() failed with error -54 for the file /Applications/Gaetano Lunches.app.
And then I try to launch directly the binary file from package contents
it says
-bash: /Applications/Gaetano Lunches.app/Contents/MacOS/Gaetano Lunches: Operation not permitted
On all MacBooks app installation from Anywhere is allowed. spctl-master is disabled. Permissions for files are correct. But the app cannot be launched.
I don't know how you are building your app, but if LSOpenURLsWithRole is returning permError = -54, this means you have a permission error on opening a file. This can mean a lot of things, but building an app in release mode is no longer what Apple recommends for you to do. Apple prefers that you use Archive and then you export the app in Organizer to be used by your users. By using this work flow, normally you can do everything using the Xcode defaults for building an app. If you don't, then you need to be more careful with the settings you choose for building in release mode.
For a quick and dirty approach, I would try the following:
1) Open the terminal
2) Type: chmod +x "/Applications/Gaetano Lunches.app/Contents/MacOS/Gaetano Lunches"
3) Try to launch your app and see if it helps. If it helps, there is something messed up with your build settings, which is failing to change the file permissions somewhere for your executable to have the right permissions to be launched.
Another thing you could try is see whether your app was blacklisted by Gatekeeper, because somehow it determined your app is doing suspicious things on your own system. If that is the case, then you can try this to see what gatekeeper is assessing:
spctl -a "/Applications/Gaetano Lunches.app"
If for some weird reason you app is being blacklisted by Gatekeeper, you can always add your app manually and whitelist it for Gatekeeper:
spctl --add "/Applications/Gaetano Lunches.app"
If all fails, you can try to reset the whole database, but you will need super user access:
sudo spctl --reset-default
However, I think these are just quick fixes, and if you keep needing this is because your build settings in Xcode must be adjusted. More on that, if any of these solutions work. Let me know about that.

Install iOS simulators from the command line

I have a CI setup with multiple slaves. I'd like to install different versions of the iOS simulator, but this needs to be done from the Downloads tab in the Xcode Preferences. Ideally there would be a command line tool that we could run to download and install specific versions. Does this exist?
If you don't care about having the system keep track of the package receipts, you can just install them on one of your systems and then rsync /Library/Developer/CoreSimulator/Profiles/Runtimes over to the other systems.
Note that after the transfer, I'd suggest doing 'sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService' on the other slaves since the service expects the profiles to be moved into place and might not respond well to the rsync.

Automate OSX Mac App Store builds

I'm looking for a way to automate the "Build and Archive" and "Organizer->Share.." for my OSX Mac App Store builds. I have read through "Xcode “Build and Archive” from command line" which is specific to iPhone development, and I'm hoping something similar can be done for my builds.
question from long ago.
It looks like now you can use Application Loader to upload binaries in addition to using XCode. Buried in the (PDF!) documentation for Application Loader is reference to a Unix build tool embedded deep in the package.
It means I can add some code to my build Makefile:
ALTOOL:="/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool"
$ALTOOL --validate-app -f Surfwriter.app.zip -u $APPSTORE_USERNAME -p $APPSTORE_PASSWORD
$ALTOOL --upload-app -f Surfwriter.app.zip -u $APPSTORE_USERNAME -p $APPSTORE_PASSWORD
Of course, before you submit Surfwriter.app.zip you have to build the binary and sign it (should be able to use xcodebuild for that)
This should theoretically do the trick for you.

Resources