iOS-deploy could not install application exited with code 253 - appium

I'm new to Appium and currently being stuck with this issue for a week, hope I can get help here.
The issue is I cannot install my test application on my real iPhone device. It always return the same error.
Encountered internal error running command: Error: Could not install app: 'Command 'ios-deploy --id 20846aec46cd64589f6a2b356ef2390b2bc6bc6c --bundle /var/folders/6p/0y20zycd7qz4q14n42zhq29c0000gn/T/2018616-7145-1norgqb.y7mt/Payload/MyAPP.ipa' exited with code 253'
When I try to run only the ios-deploy command, the error return is:
ios-deploy[10050:85931] [ !! ] Error 0xe8008015: A valid provisioning profile for this executable was not found. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
As my understanding, the iPhone need to be installed the WebDriverAgent before installed the testing application, however, I don't see anything related to install WebDriverAgent on the progress, it just go straight to install the testing application.
Below is my device info:
Appium server: 1.8.1
Device: iPhone 5s (also try with iphone 6) iOS 11
My using Desired capabilities:
{
"platformName": "iOS",
"platformVersion": "11.0.1",
"deviceName": "iPhone 5s",
"automationName": "appium",
"udid": "20846aec46cd64589f6a2b356ef2390b323c6bc6c",
"bundleID": "io.apptest.s",
"app": "/path/to/my/MyAPP.ipa"
}

Yes this is actually really tricky, follow these steps, and You might be able to install Your app.
STEP 1. download driver appium-xcuitest-driver
STEP 2. setup You environment:
After the successful installation now apply these steps carefully. After installation, open terminal and run following commands:
brew install libimobiledevice –HEAD
brew install ideviceinstaller
brew install carthage
npm install -g ios-deploy
gem install xcpretty
After successful installation, the terminal will print BUILT SUCCEEDED on the console so moving on step 03 for web driver protocol configuration
STEP 3.
Now open Xcode and open the XCUITest project that you will get from the following folder in your mac
/Users/someName/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
Once, WebDriver.xcodeproj is opened so make sure that WebDriverAgentLib, WebDriverAgentRunner, and IntegrationApp is showing on the file as below screenshot.
Now select IntegrationApp and simulator as iPhone X and run the application. As the application is deployed successfully and launches o the simulator successfully so now you are good to go with Appium.
Step 4.
Click on Appium application from Launchpad and click on “Start the server v1.7.2″ as the server is started, Click on the “Start Inspector session” to set the required capabilities.
This is bellow for java code, but first try it out with Appium server gui:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”, “iPhone 7”);
capabilities.setCapability(“platformName”, “IOS”);
capabilities.setCapability(“platformVersion”, “9.3”);
capabilities.setCapability(“browserName”, “safari”);
capabilities.setCapability(“automationName”, “XCUITEST”);
If now is all good to go, write code.
NOTE: Once all is installed and setup, remember to set **automationName as "XCUITest".**

Check sign by
codesign -v --verbose /var/folders/6p/0y20zycd7qz4q14n42zhq29c0000gn/T/2018616-7145-1norgqb.y7mt/Payload/MyAPP.ipa
maybe you can find the answer.

Related

How to fix expo start throwing "Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; dont know what that is"

I am trying to set up a react-native development environment. I would like to set up an iOS emulator (preferably an iPhone 10) to run my app on. I am using a Macbook Pro 2016 running on MacOS 10.14.3. I have installed my react-native app through the command create-react-native-app (running version 2.0.2). I also have installed XCode running version 10.2(10E125). When I scan the QR code that Expo generates and run it on my iPad or my Android device it works just fine, but when I try to load the iOS emulator by pressing i after expo start it returns the error
Trying to open the project in iOS simulator...
Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; don't know what that is.
Simulator not installed. Please visit https://developer.apple.com/xcode/download/ to download Xcode and the iOS simulator. If you already have the latest version of Xcode installed, you may have to run the command `sudo xcode-select -s /Applications/Xcode.app`
I have already tried running the command sudo xcode-select -s /Applications/Xcode.app
I have also tried running the command xcode-select -r
I have also confirmed that in my XCode->Preferences->Locations Command Line Tools is selected as "Xcode 10.2(10E125)"
None of these have worked.
I am expecting that after pressing i after expo start an iOS emulator loads up. Thank you.
-----EDIT-------
After some more research, I found out that running open -a Simulator and then running expo start loads the app on an emulator and works for my purposes. But still if I just run expo start without running open -a Simulator it still gives the same error. I want to ask if this is the best I am going to get?
You might be running an outdated version of Expo. I had this problem when I was download someone's old repo using Expo 27 when Expo 36 came out. After updating to the latest version, it works.
To update packages in your project, npm-check-updates comes in handy.
npm i -g npm-check-updates # installs ncu globally
ncu -u # updates all dependency versions in your local package.json
npm install # updates the packages in node_modules to match
Note: This will update all your dependencies to the latest version. If you don't want to do this, you can find the latest version of expo and change the version in package.json manually.
I ran into the exact same problem all of a sudden. Clicking "Run on iOS Simulator" within the Expo Developer Browser worked 2 days ago but did not work today. Your clue of using open -a Simulator helped me though. I went into Xcode and clicked the Xcode menu > Open Developer Tool > Simulator. This started the Simulator and then I was able to click "Run on iOS Simulator" within the Expo Developer Browser and it worked as expected. If you haven't had the fortune of "Run on iOS Simulator" working, I'm guessing you could just start a simulator, download Expo from the App Store and just use it from there. None of this answers the question as to why the error happens but at least gives a few workarounds for anyone else that might need. All that matters is you get the app running on the Simulator in the end!

Having issues with WebDriverAgent - Appium / Xcode

I believe I have messed up WebDriverAgent.xcodeproj in an attempt to launch my app on a device for testing... is there any way to start over, i.e. delete all corresponding files and then reinstall? I do not seem to be able to do this. Thanks!
One suggestion is to uninstall and install appium.
npm uninstall -g appium and
npm install -g appium
Then open WDA xcode project and reconfigure them all.

You may not have the required environment or OS to run this project - Cordova - iOS

I'm working with Cordova to build my mobile app. I'm working on a Mac machine and when I try to build and run my app on iOS device, but I'm keep getting this error.
When running:
cordova build ios
output:
** BUILD SUCCEEDED **
then I run
cordova run ios
I get the error
.../ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
If I try to open the project in Xcode and run it, it successfully run on the device.
I notice that before the run failed, it output the message
ios-sim was not found. Please download, build and install 'npm install -g ios-sim'
I'm guessing Cordova thinks the device isn't plugged in since the ios-sim is a simulatur plugin for cordvoa. But I may be wrong.
Any ideas?
(This question is similar to Cordova: You may not have the required environment or OS to run this project, but this question regarding iOS there that Android)
try
npm install -g ios-sim
npm install -g ios-deploy
I suggest you read iOS Platform guide for more info.

Platform ios already installed

I'm tryin' to debug my app on iOS simulator in my Mac.
I've followed all the instructions installing on my Mac:
sudo npm install -g vs-mda-remote
sudo npm install -g ios-sim
When I prompted
vs-mda-remote --buildDir Projects
(Projects is the folder where debug files will be droped), I see results in my PC by
http://<MAc_IP>:3000
With the following text
Remote build Express server open for business on port 3000
Ok, now I prompted
vs-mda-remote test
And I see an error with the following message
Failed to build app: CordovaError: Platform ios already added
I don't know what happen.
Ok, I found the problem. Maybe, I'm too eagier.
Instead of using one session in terminal app on mac, I used too many, so, when I prompted too many timesvs-mda-remote, obviously ios was already installed.
So, opening terminal at first time, and prompting
vs-mda-remote --buildDir Projects --allowsEmulate=true
Now, I can debug on iOS simulator from my PC to Mac.
While running the build agent, the correct command is:
vs-mda-remote --buildDir <server-build-directory> --allowsEmulate=true
Note the last "--allowsEmulate=true" part of the command.
*Taken from "Setting up the Remote Agent to Support Starting the iOS Simulator" section in the documentation.
Platform ios already installed
Received this error for running in device too, while running multiple instance in mac.
Quit Terminal and run single instance for vs-mda-remote to resolve this problem if you receive this error for running in Device.

Launch application on non-jailbroken iOS device from command line on macintosh [duplicate]

I'm using xcodebuild install -alltargets -iphoneos4.2 -activeconfiguration provisioning_profile=path_of_my_provisioningprofile code_sign_identity=identity.
This command is building my app and i am getting build file (.app) also.
But how to install the app in to device from command line.
Please help me in this issue.
Fruitstrap is no longer maintained, for a more up to date project checkout the fork by PhoneGap called ios-deploy.
To install run: npm install -g ios-deploy
Here are some examples of how to use it:
// deploy and debug your app to a connected device
ios-deploy --debug --bundle my.app
// deploy and launch your app to a connected device, but quit the debugger after
ios-deploy --justlaunch --debug --bundle my.app
// deploy and launch your app to a connected device, quit when app crashes or exits
ios-deploy --noninteractive --debug --bundle my.app
// Upload a file to your app's Documents folder
ios-deploy --bundle_id 'bundle.id' --upload test.txt --to Documents/test.txt
Fruitstrap:
https://github.com/ghughes/fruitstrap
Here's a good tutorial to set it up:
http://sgleadow.github.com/blog/2011/11/05/installing-ios-apps-on-the-device-from-the-command-line/
Looking around found https://github.com/benvium/libimobiledevice-macosx. This is a port from libimobiledevice to MAC-OS X. Its very useful and no jailbroken is needed. :P
Use this beautiful script : http://gamua.com/blog/2012/03/how-to-deploy-ios-apps-to-the-iphone-via-the-command-line/
- Then connect iphone device via usb to mac running this command
To launch app on command line:
instruments -w 4xxxxxxxx9 -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate NITC -e UIASCRIPT Launch-App.js
format : instruments -w <deviceid> -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <applicationname> -e UIASCRIPT Launch-App.js
My Launch-App.js has only one line - var target = UIATarget.localTarget();
This must be sufficient to launch application on device using command line
What about this:
how to intall an ipa/app file into iPhone with command line?
Third solution with libimobiledevice.
ipatool: https://github.com/majd/ipatool
Step 1: Search the app bundle id
./ipatool search testflight --limit 1
> ==> ℹ️ [Info] Searching for 'testflight' using the 'US' store front...
> ==> ℹ️ [Info] Found 1 result:
> 1. TestFlight: com.apple.TestFlight (3.1.0).
Step 2: Download the IPA
./ipatool download --bundle-identifier com.apple.TestFlight
Easy!
Install following packages on MAC
brew install libimobiledevice
brew install ideviceinstaller
After successfully installed above packages.
Use following command to install .ipa file on iOS devices:
ideviceinstaller -i <Path_to_your_ipa>
Thanks

Resources