App opens and crashes on simulator using desktop Appium app - ios

Test Environment
Desktop OS/version used to run Appium:Version 1.2.0-beta.3 (1.2.0-beta.3)
Node.js version (unless using Appium.app|exe):
Mobile platform/version under test:ios simulator
iPhone 6s plus 10.2
1.Pulled latest code from sourcetree
2.opened xcode
3.made a archive file
4.got the app file from there.
5.opened Appium desktop app
6.added the desired capabilities
.{
"app": "/Users/Desktop/PreProd.app",
"platformName": "iOS",
"deviceName": "iPhone 6s Plus",
"platformVersion": "10.2",
"automationName": "XCUITest"
}
8.The app opens and crashes
appium log file

try to follow the below tutorial for real device setup
https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md
If it is done already, restart your device and MAC once and try executing again.

To run in simulator, you should get the .app file from simulator folder NOT from the xcode archives.
The architecture for the archived build will be arm64/armv7, which can only be installed in real device.
To get .app file for Appium test in simulator :
Open project in Xcode --> expand your project --> expand products --> you will see .app file there.Go to file location and copy .app file.
You can use this .app file for Appium test in simulator.
Note : this only help if you have access to Source code. If you don't have access to source code to run the project and only have archived build, then only option you have is to run it in real device.

The application crashes because the .app file you are trying to launch is either
Not simulator compatible
Not bundled and compiled with the current simulator architecture
Has incorrect bundle id
Try building the .app file for the simulator using the xcode command
xcodebuild -arch x86_64 -sdk iphonesimulator11.3 -workspace {projectname}.xcworkspace -scheme {schemaname} -configuration {configurationname} SYMROOT=${WORKSPACE}/build/{projectname}.xcarchive
Once the .app file is generated, use that and try launching.

Related

.app crashes upon launch in IOS simulator on M1

I'm trying to launch an .app build on iOS simulator for automation purposes. My steps:
Download an .ipa file from app distribution resource
Unzip .ipa and get .app bundle from Payload folder
Simply drag and drop the .app bundle on the running simulator
And.. when I try to launch the .app this simply crashes. I'm not seeing any logs though. Funny thing is that my teammate is doing this successfully and the only difference between our machines is that my one is on M1 chip and hers is on Intel.
I've also tried to check the box "Open with Rosetta" with no success.
versions:
macOS Monterey 12.0.1,
xcode and simulator 13.1
Any ideas what I'm doing wrong here?

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

How to install ipa file on simulator or real device?

I have ipa file and I can extract the app file if I dragged and drop the app file to simulator it's crashing in the landing page,
Whenever I'm dragging the ipa file to device and simulator manager I'm unable to install it for both simulator and real ios
However, when I am using same ipa file with BrowserStack it's installing the ipa without any problem and its working fine.
I am not sure what I'm missing
What is the correct follow of installing the ipa/app file for both emulator and simulator?
To install the app on iOS Simulator:
xcrun simctl install <Simulator ID> <Path to .ipa>

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.

Running iOS app on a different Mac / simulator

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.

Resources