question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Appium does not detect the pre-existing app on iOS device

See original GitHub issue

The problem

When I attempt to run appium with iOS bundle id, it says app was not installed

Environment

  • Appium version (or git revision) that exhibits the issue: Appium 1.5.3
  • Desktop OS/version used to run Appium: MAC OSX 10.11.6
  • Node.js version (unless using Appium.app|exe): 5.12.0
  • Mobile platform/version under test: iPhone 6 with iOS 10
  • Real device or emulator/simulator: Real device
  • Appium CLI or Appium.app|exe: CLI

Details

My script :

class SimpleIOSTests(unittest.TestCase):
    def setUp(self):
        # set up appium
        self.driver = webdriver.Remote(
            command_executor='http://localhost:4723/wd/hub',
            desired_capabilities={
                'app': 'com.XXXX.XXX',
                'udid':'MY UDID',
                'platformVersion': '10.0',
                'platformName': 'iOS',
                'deviceName': 'xPhone'
            })
......

Appium logs:

[debug] [iOS] App is an iOS bundle, will attempt to run as pre-existing [debug] [iOS] Removing any remaining instruments sockets [debug] [iOS] Cleaned up instruments socket /var/folders/58/9bpqjjfj2kq6thd7_knk0t5c0000gq/T/instruments_sock [debug] [iOS] No language specified. Using default strings [debug] [iOS] Strings file not found. Looking in ‘en.lproj’ directory [iOS] Could not file localizable strings file ‘Localizable.strings’! [debug] [iOS] Creating instruments [debug] [UIAuto] Preparing bootstrap code [debug] [UIAuto] Dynamic bootstrap dir: /Users/fyu/Library/Application Support/appium/bootstrap [debug] [UIAuto] Dynamic env: {“nodePath”:“/usr/local/Cellar/node5/5.12.0/bin/node”,“commandProxyClientPath”:“/usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js”,“instrumentsSock”:“/var/folders/58/9bpqjjfj2kq6thd7_knk0t5c0000gq/T/instruments_sock”,“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”} …bug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify! [debug] [UIAuto] Dynamic bootstrap path: /Users/fyu/Library/Application Support/appium/bootstrap/bootstrap-c22bb713e711df3f.js [debug] [UIAuto] Reusing dynamic bootstrap: /Users/fyu/Library/Application Support/appium/bootstrap/bootstrap-c22bb713e711df3f.js [debug] [iOS] Running ios real device reset flow [debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog [debug] [iOSLog] Found idevicesyslog: ‘/usr/local/bin/idevicesyslog’ [debug] [iOS] Creating iDevice object with did MY UDID [debug] [iOS] App is not installed. Will try to install. [MJSONWP] Encountered internal error running command: Error: Installing com.XXXX.XXXX failed at /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/node-idevice/main.js:159:6 at ChildProcess.exithandler (child_process.js:193:7) at emitTwo (events.js💯13) at ChildProcess.emit (events.js:185:7) at maybeClose (internal/child_process.js:850:16) at Socket.<anonymous> (internal/child_process.js:323:11) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7) at Pipe._onclose (net.js:484:12)

Then I modify the main.js:

IDevice.prototype.install = function (app, cb) {
    exec(this._build_cmd(['-i', wrapForExec(app)]), function (err, stdout, stderr) {
    if (err) {
        cb(err, stdout);
    } else {
        if (stdout.indexOf('Complete') != -1) {
        cb(null);
        } else {
**Here use cb(null) to instead of threw new error**
        //cb(new Error('Installing ' + app + ' failed'));
        cb(null);
        }
    }
    });
};

Then I relaunch appium server and run my script, it works fine.

BTW, when I run ideviceinstaller -l manually, it prompts “Could not connect to lockdownd. Exiting.”, but I don’t know why this happened. Maybe it’s the root cause.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
VasilijSviridovcommented, Oct 20, 2016

To run automation on iOS10 you need to use appium 1.6 with xcuit driver 😃 appium 1.5.3 won’t work on iOS10.

3reactions
mayureshshirodkarcommented, Sep 8, 2016

Meanwhile, After a lot of googling and research, came across this post. Helped me fix the issue. May be a temporary fix, but it works.

http://stackoverflow.com/questions/39035415/ideviceinstaller-fails-with-could-not-connect-to-lockdownd-exiting

Use: sudo chmod -R 777 /var/db/lockdown/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appium couldn't connect to my real device IOS - Issues/Bugs
I put the link of my app in ios settings and bundle id + udid, I got the following error in appium while...
Read more >
App is not installing on the real iOS device - Appium Discuss
I successfully installed the app onto a real device via Xcode. Then I was able to run my automated tests on it. However,...
Read more >
Unable to Launch pre-launch IOS app on device - Support
Hello Folks,. IOS App not able to pre-launch I got below exception kindly check below log any help appreciated , below is my...
Read more >
Not able to lauch appium inspector for real device - Issues/Bugs
Go to appium and point the App path to XYZ.app. Launch the appium inspector and getting below error. info: Client User-Agent string: Appium...
Read more >
Unable to launch Appium for iOS - Support
either provide app or bundleID - not both. · Remove the string after iPhone 5 in the Device name (you can edit the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found