Running iOS app on a different Mac / simulator - ios

I have built a demo iOS app on my Mac. My client wants to get the executable and run it on his iOS simulator on his Mac so as to give me feedbacks. I have an Apple developer account and I can deploy my app to my iPad / iPhone or distribute it via AppStore. But I don't know how to generate an iOS simulator executable for him. He only wants the iOS simulator executable. Does anyone have tried this before?
P.S. I can't really distribute it via AppStore since it is just a demo app. It is very likely rejected. Plus, I have to send it to him today so I don't think Apple can pass my app within a day.
P.P.S. I can't give him the source code unless he pays me. But it is not possible after a month.
Please help. Thanks in advance!

You need to send him the Application folder under the iPhone Simulator folder.
You can find it here:
~/Library/Application Support/iPhone Simulator/<Simulator-Version>/Applications/

Building upon this answer by #Midhun, for later versions of Xcode (Xcode 6, Xcode 7 and Xcode 8 in my research), the simulators now live here:
~/Library/Developer/CoreSimulator/Devices
I was actually trying to use an app built on Xcode 8 for iOS8 simulator and get it to run on an ios7 simulator from Xcode 6 on another Mac. I couldn't find out how to simply copy files around but I did manage to copy the Mine.app folder to the other Mac, then install it using
xcrun simctl install 6DC6323C-504C-423F-ACD6-652557B33D48 Mine.app
where you need to replace 6DC6323C-504C-423F-ACD6-652557B33D48 with your simulator device type ID (find using xcrun simctl list devices).

For running app, build on other mac machine to yours machine simulator. we require .app file for that project.
run below command in terminal
xcrun simctl install booted $LOCATION/FILENAME.app
replace $LOCATION with the path and the FILENAME should be the name.for more details check this link => https://www.webdigi.co.uk/blog/2016/how-to-transfer-your-app-to-an-ios-simulator-on-another-machine-using-app-file-and-xcrun/

iOS Run .app on another simulator
Build .app[About]
Xcode: Product -> Build
xcodebuild command[About]
//building workspace
xcodebuild -workspace "/path/to/workspace" -scheme "MyShemeName" -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
Find .app
//1. Build location*. Usually it is derived data folder
//2. Xcode.
Project navigator -> project -> Products group
//3. Get it from iOS simulator
Activity Monitor -> <App Name>(not Xcode) -> Double click -> Open Files and Ports -> Find <App Name.app> path -> find and copy a file <App Name.app> by path -> save the file locally
[Build location]
Install .app
xcrun simctl install booted <app_path.app>

Or you can send just the one app you need from ~/Library/Application\ Support/iPhone\ Simulator/7.0/Applications/GUID-OF-YOUR-APP

i have used a similar tool called Simulator Bundler in a recent project with no issues,
https://github.com/landonf/simlaunch/downloads

Midhun MP answer is good but in case of solution don't work then in emergency sometimes making video and sending it to client would help. This tool provide light weight video creation.
http://www.screencast-o-matic.com/
You can resize it for your simulator.

Related

How can I build and run an iOS Swift app from the terminal?

I've recently started learning Swift and SwiftUI for iOS development and I completely understand how to run my apps for testing using XCode. You just click the play button with whatever simulator device is selected. However, I really don't like using XCode. I want to use VSCode for my development. Looking online I can find very complicated tutorials on how to build my project for release on the App store or "Ad-Hoc" from the terminal. But, I don't think this is what I need. I'm wondering if there is a way to build and run my app from the terminal on to a simulator or personal device (connected with USB)? I understand I can just have XCode open on the side and run it from there while developing from VSCode, but, my computer is kind of old and having both those apps open makes my fans go crazy.
You can follow this guide on how to build your project using xcodebuild.
Assuming you are in the directory with the .xcodeproj file, the command will look something like this:
xcodebuild -destination "platform=iOS Simulator,name=iPhone 14 Pro Max,OS=16.0" -scheme YourScheme SYMROOT="./build" build
Of course, you can choose any simulator you like. You can find a list of the simulators by doing xcrun simctl list.
The built app will be located in a folder called build/Debug-iphonesimulator, or build/Release-iphonesimulator, depending on your default configuration. The configuration can be set by the -configuration option.
Now you can launch the simulator. Here is a guide for that. Basically, you just specify the UUID of the simulator (again you can find this using xcrun simctl list), and then launch Simulator.app. Example:
xcrun simctl boot 8F9690AC-FCDE-4913-9BD2-E54B3CC9F6C1
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/
To install the built app, you also need the UUID (see also this answer)
xcrun simctl install 8F9690AC-FCDE-4913-9BD2-E54B3CC9F6C1 build/Debug-iphonesimulator/YourApp.app
Finally, you launch your app by specifying the UUID of simulator, and the bundle ID of your app (source)
xcrun simctl launch 8F9690AC-FCDE-4913-9BD2-E54B3CC9F6C1 com.mydomain.YourAppBundleId

How to Install .ipa File on XCode iOS Simulator

I have downloaded an .ipa file from an iOS developer for our project.
I need to test the app on my simulator because I don't have a physical device, but I don't know how to.
how to install the .ipa file to XCode iOS Simulator? I have been read the difference between emulator and simulator, which the .ipa only able installed on real device and emulator while the .app only able installed on simulator. The emulator also mimic the real device's hardware and software while simulator only mimic the software and interface. If those differences above are true, does anyone know how to convert the .ipa to working .app file? I have been tried changed the .ipa to .zip by rename it then extract it and last, drag and drop the .app file (in the payload folder after extracted) to my simulator but failed, the message is "Please update the app". I also tried the command xcrun simctl install but failed. Currently, I am using the Mac with Big Sur and XCode 12. I can't download the project because the project size is very big and my internet too slow for download it, Thank you all
Since you have the ability to run the simulator, You have the ability to have Xcode installed.
Rather than have the developer send you the IPA file, you could get access to the source code for your project (usually this is on a Git service provider) download the source and build the app to the simulator directly.
In a well set up project it shouldn't be hard to clone the repository, maybe run some configuration, then open Xcode and build to the simulator
I have the same problem, and refer to that link before. it seems noway but to buy an iphone test device...

Cannot select iOS Phone Simulator in Android Studio for Flutter

I have an issue. I started to code in Android Studio and I want to select iOS Simulator. However, I can select only option Open iOS Simulator which opens.. a watch!
How could I launch a phone as a simulator?
I tried going into Simulator itself, but couldn't find any ways how to do it.
Open iOS Simulator externally first. Now, open Xcode, Select your latest Xcode version in Xcode -> Preferences -> Locations -> Command Line Tools
Now, go to Terminal and run flutter doctor See if it shows any iOS device connected.
If yes, then you're done. Now you can see opened simulator can be seen in Flutter Device Selection and used to run your flutter application in iOS Simulator.
If No, then open terminal of project and run xcrun simctl list, from list of devices copy UID of wanted device and run xcrun simctl boot *SELECTED_UID*
After extensive research, I found a solution.
First, go to your xcode.
xcode -> Preferences -> Components and install selected iOS version.
After installation is finished, head to Android Studio go to Terminal tab and write xcrun simctl list - you will get list of devices. Select which one you want to use, copy UID (bunch of numbers) and use it with this command xcrun simctl boot *YOUR_DEVICE_ID*
Hope it helps for someone with same issue!

How to run a previously compiled version (or a previous build) of an Xcode project in ios 10.0 simulator

I'm trying to test one of my apps on ios 10. I have downloaded the Xcode 8 beta which ships with the ios 10.0 Simulator. However, as expected, Xcode 8 is throwing tons of errors on the libraries I'm using [like Alamofire] which is preventing me from building in Xcode 8, which I don't feel I need to worry about right now. I'm just looking for an easy way to run the last stable compiled version (which I can successfully build within Xcode 7 for ios 9.3). I am unable to trigger the ios 10.0 Simulator from my terminal via xcrun as I have used to achieve similar things in the past.
Any guidance would be much appreciated!
EDIT -- Solved
I figured out a way to achieve what I was looking for, for those interested.
In Xcode7 go to Preferences > Locations > and change Command Line Tools to Xcode 8.0
In Terminal, type xcrun simctl list to see the available Simulators (ios 10.0 simulators should be available now).
Copy the UDID of the Simulator you want.
Make sure the normal Simulator app is not running, then run open /Applications/Xcode-beta.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID <Copied UDID>
After the desired Simulator is booted, run xcrun simctl install booted <path to project .app file> (the path to the .app file can be found in Xcode on the left pane, under your main project, under the folder "Products" copy the file path from the [project-name].app file located there)
This should install the app onto the desired Simulator. I did encounter some errors the first few times I tried this. I got around them by simply quitting the Simulator.app and trying again (Worked for me on the fourth try).

Run .app file in iOS 8 simulator

I have a .app file shared from a developer which i would like to run in iOS 8 simulator. I have seen similar questions which has solutions for older versions of iOS which is no longer working for iOS 8. Can someone point out what needs to be done to run the .app file in an iOS 8 simulator without using xcode.
Boot the simulator you want to install it to in the iOS Simulator and then do the following:
xcrun simctl install booted /path/to/Your.app
xcrun simctl launch booted com.yourcompany.yourapp
The "booted" token was not supported on older versions of simctl in Xcode 6.0. If you get an error, please use the full device UDID instead of "booted". You can determine the UDID by running xcrun simctl list
If the application crashes after installing in the simulator using the command,
xcrun simctl install booted /path/to/Your.app
It's probably because the architecture issues, since we used the device build instead of simulator build.
The basic architecture difference between the iphone simulator and iphone device is
iPhone simulator uses the architecture i386 or x86_x64
whereas,
iPhone device uses the architecture arm64 or armv7 or armv7s
We can find each device architectures in this link. So to over come this problem we need to get the simulator build by changing the xcode build location settings.
SOLUTION :
To change the build location settings, Open your xcode and follow the below steps.
Go to xcode preferences.
Choose the locations tab.
In the 'Derived Data:' section click 'advanced', from the resulting screen choose 'legacy'.
Now build the application, after successful build go to 'Your-App-Folder/build/Debug-iphonesimulator' in finder, and copy the build available on the same folder with the extension .app
Copy that and run the above command answered by #jeremy.
xcrun simctl install booted /path/to/Your.app
After running this command, note that your simulator is installed with the build you specified. There you go, run the application in simulator by clicking the corresponding app and use it.
I deliberately write this solution to help the needy, those who are clueless about the architecture issues specified above.
Happy Coding :)
iOS Simulator also supports dragging and dropping for installing .app files
Open Simulator
you can do it through XCode under XCode > Open Developer Tool > Simulator
to open it "without using xcode", see these answers.
Find the .app file in Finder and drag it into your Simulator window
Wait for the app to install and launch it
For developers looking to provide a simulator build to theirs testers, these are the steps that I followed to create and test a build -
Add i386 in valid architectures section of build settings.
Open terminal and navigate to your project folder. Then execute the command -
xcodebuild -arch i386 -sdk iphonesimulator8.1
(This will build the application)
To install the application on simulator, run the command mentioned in the above answer i.e -
xcrun simctl install booted /path/to/Your.app
Now you should be able to run the app by clicking on the installed application in the simulator.
I have followed all the above commands and stuff but none worked. All I was doing is creating .app through archiving the app from Product->Archive and then converting that generated .ipa to .app by changing the extension to .zip.
But the app is crashing as and when it is being launched.
For those facing the same issue, go to
DerivedData/projectname/Build/Products/Debug-iphonesimulator/
folder. There you can find the .app file with app name. You need to use this .app file by dragging and dropping onto the simulator. Product->Archive->.app doesn't work.

Resources