Appium appium + iOS Could not connect to lockdownd. Exiting.

小茗同学 · 2017年02月20日 · 2577 次阅读

我使用的是客户端的 appium,想获取真机的元素 id,点击 appium 的 Launch 后再点击放大镜的图标报错然后就执行 ideviceinstaller -l ,结果报错 Could not connect to lockdownd. Exiting.
百度说需要执行 sudo chmod -R 777 /var/db/lockdown 命令,结果还是报错,希望大神指教,谢谢

共收到 22 条回复 时间 点赞

为什么没有人回答我的问题呢😭 😭 😭

解决方式:修改 var/db/lockdown 文件夹的读写权限。
步骤:

  1. Finder 》前往菜单 》前往文件夹》进入/var/db/
  2. 找到 ‘lockdown’ 文件夹 》右键,显示简介 》底部的 ‘共享与权限’ 项,打开右下角的锁(输入电脑密码)》加号,将自己的账号添加进权限表中,修改自己的权限为 ‘读与写’ 》锁定权限表即可。
aylin 回复

ios10.1.1 用了这个方法还是不行,ios9.3 使用正常,你们用的是什么版本


11018  brew uninstall ideviceinstaller -g
11020  brew uninstall libimobiledevice -g
11021  brew install --HEAD libimobiledevice -g
11022  brew install ideviceinstaller -g
sudo chmod -R 777 /var/db/lockdown

重装下,然后给权限。

aylin 回复

对,我也是 10 的系统不可以,9 的及系统就可以,是什么原因呢

恒温 回复

同时也解决了我的 idevicescreenshot 截图的问题,谢谢你!

程序的安装方式、方法不一样,会导致工具可能不能正常使用,很困惑。

Michael_Wang 回复

那是因为系统更新了,你的工具没有更新或者重新编译啊。

恒温 回复

谢谢 大神 没报这个错了
brew uninstall libimobiledevice -g
Error: Refusing to uninstall /usr/local/Cellar/libimobiledevice/1.2.0
because it is required by ios-webkit-debug-proxy, which is currently installed.
You can override this and force removal with:
brew uninstall —ignore-dependencies libimobiledevice
liuyinpingdeMac-mini:db liuyinping$ brew uninstall —ignore-dependencies libimobiledevice
Uninstalling /usr/local/Cellar/libimobiledevice/1.2.0… (65 files, 982.0K)

ly_ping 回复

你全部卸载了。 ios-webkit-debug-proxy 也卸载了。

@Lihuazhang
brew install libimobiledevice
我昨天试了卸载后这样重新安装,ios8、ios9 可以截图了,ios10 还是不能截图。

今天看到你的回复后,卸载了执行 brew install --HEAD libimobiledevice -g 这个,就都可以了

恒温 回复

我刚又重新卸载安装了多次,只有加上 --HEAD 参数安装后,才能对 ios10 支持。

我查了下 --HEAD 意思是安装的非稳定版本的分支,但是时比较新的代码,可能包含了新功能和 bugfix。
关于 -g 查了下 man brew,并没有看到 -g 参数。

谢谢恒温

恒温 回复

没卸载 ios-webkit-debug-proxy 按他的提示执行了 brew uninstall —ignore-dependencies libimobiledevice 然后执行 install --HEAD libimobiledevice -g
之前太粗心了 没注意这个错误 所以没成功,刚刚试了用 appium 1.5.3 安装 debug 包在 ios10.1 上是成功了 但是 inspector 还是没起来,在看看是什么问题

ly_ping 回复

appium 1.5.3 的 inspector 好像早就不能用了吧。 不确定。

恒温 回复

appium 1.5.3 的 inspector 在 ios 10 没跑起来 ios9 可以跑起来

ios 10 报的错误:

2017-02-23 14:52:50:408 - [debug] [Instruments] [INST STDERR] 2017-02-23 14:52:50.408 instruments[26163:392816] Failed to locate a valid instance of CoreSimulatorService in the bootstrap.  Adding it now.

2017-02-23 14:52:50:419 - [debug] [Instruments] [INST STDERR] 2017-02-23 14:52:50.419 instruments[26163:392816] *** Assertion failure in -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreSimulator/CoreSimulator-209.19/CoreSimulator/SimServiceContext.m:536

2017-02-23 14:52:50:485 - [debug] [Instruments] [INST STDERR] 2017-02-23 14:52:50.484 instruments[26163:392816] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The loaded com.apple.CoreSimulator.CoreSimulatorService job does not match our expectations: pathOfLoadedJob: /Users/liuyinping/Downloads/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService, our frameworkPath: /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8df2a4f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff96ee8f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8df2f1ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff8fc7c856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   CoreSimulator                       0x0000000108a743e9 -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid] + 1313
    5   CoreSimulator                       0x0000000108a74d01 -[SimServiceContext connect] + 41
    6   CoreSimulator                       0x0000000108a737a6 -[SimServiceContext initWithDeveloperDir:connectionType:] + 1108
    7   CoreSimulator                       0x0000000108a73071 __63+[SimServiceContext sharedServiceContextForDeveloperDir:error:]_block_invoke_2 + 127
    8   libdispatch.dylib                   0x00007fff9f9fb40b _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x00007fff9f9fc9f2 _dispatch_barrier_sync_f_invoke + 74
    10  CoreSimulator                       0x0000000108a72ea6 +[SimServiceContext sharedServiceContextForDeveloperDir:error:] + 226
    11  XRMobileDeviceDiscoveryPlugIn       0x00000001142c464d XRMobileDeviceDiscoveryPlugIn + 26189
    12  libdispatch.dylib                   0x00007fff9f9fb40b _dispatch_client_callout + 8
    13  libdispatch.dylib                   0x00007fff9f9fb303 dispatch_once_f + 67
    14  XRMobileDeviceDiscoveryPlugIn       0x00000001142c4537 XRMobileDeviceDiscoveryPlugIn + 25911
    15  XRMobileDeviceDiscoveryPlugIn       0x00000001142c2e13 XRMobileDeviceDiscoveryPlugIn + 19987
    16  InstrumentsPlugIn                   0x0000000108da3f40 _startListening + 86
    17  libdispatch.dylib                   0x00007fff9f9fb40b _dispatch_client_callout + 8
    18  libdispatch.dylib                   0x00007fff9f9fc9f2 _dispatch_barrier_sync_f_invoke + 74
    19  InstrumentsPlugIn                   0x0000000108da3d00 __47+[XRDeviceDiscovery _faultDeviceDiscoveryImpls]_block_invoke + 592
    20  libdispatch.dylib                   0x00007fff9f9fb40b _dispatch_client_callout + 8
    21  libdispatch.dylib                   0x00007fff9f9fb303 dispatch_once_f + 67
    22  InstrumentsPlugIn                   0x0000000108da3aae +[XRDeviceDiscovery _faultDeviceDiscoveryImpls] + 91
    23  InstrumentsPlugIn                   0x0000000108da5a09 +[XRDeviceDiscovery devicesMatching:] + 44
    24  instruments                         0x0000000108a5b735 instruments + 10037
    25  instruments                         0x0000000108a5f9ef instruments + 27119
    26  libdyld.dylib                       0x00007fff91ffa5ad start + 1
)

2017-02-23 14:52:50:486 - [debug] [Instruments] [INST STDERR] libc++abi.dylib: terminating with uncaught exception of type NSException
2017-02-23 14:52:50:493 - [debug] [Instruments] Instruments exited with code null

2017-02-23 14:52:50:497 - [Instruments] Error launching instruments: Instruments crashed on startup



2017-02-23 14:53:16:143 - [Instruments] Error launching instruments: Instruments crashed on startup

2017-02-23 14:53:16:089 - [iOSLog] [IOS_SYSLOG_ROW] Feb 23 14:53:16 chenyibode-iPod locationd[59] <Notice>: message 'kCLConnectionMessageWatchdog' received from client '/System/Library/LocationBundles/AppGenius.bundle'
2017-02-23 14:53:16:141 - [debug] [Instruments] Instruments exited with code 253
2017-02-23 14:53:16:210 - [iOSLog] [IOS_SYSLOG_ROW] Feb 23 14:53:16 chenyibode-iPod gputoolsd(GPUToolsCore)[1877] <Notice>: schedule invalidation <DYTransport 0x1003027b0, error: lost transport connection (31)>
2017-02-23 14:53:16:211 - [iOSLog] [IOS_SYSLOG_ROW] Feb 23 14:53:16 chenyibode-iPod gputoolsd(GPUToolsCore)[1877] <Notice>: terminating daemon 0x100302480
2017-02-23 14:53:16:212 - [iOSLog] [IOS_SYSLOG_ROW] Feb 23 14:53:16 chenyibode-iPod DTServiceHub(DVTInstrumentsFoundation)[1473] <Notice>: Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
2017-02-23 14:53:16:212 - [iOSLog] [IOS_SYSLOG_ROW] Feb 23 14:53:16 chenyibode-iPod notification_proxy(MobileSystemServices)[236] <Notice>: 0x16e113000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!
2017-02-23 14:53:16:213 - [iOSLog] [IOS_SYSLOG_ROW] Feb 23 14:53:16 chenyibode-iPod notification_proxy(MobileSystemServices)[236] <Notice>: 0x16e087000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!
2017-02-23 14:53:16:221 - [HTTP] <-- POST /wd/hub/session 500 33835 ms - 232 

2017-02-23 14:53:16:209 - [Instruments] Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (lib/instruments.js:220:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28
    at flush (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
Michael_Wang 回复

你用的 appium 是 1.5.3 吗 怎么在 ios10 的设备上跑起来哦

ly_ping 回复

日志相关的请用代码块。 9 能跑起来正常,10 为什么跑不起来。 不清楚。这个项目都已经不维护了。

恒温 回复

是因为 10 不支持 uiautomation 改用 xcuitest?

ly_ping 回复

我用的 Macaca,模拟器上 iOS 10 是可以跑起来的

恒温 回复

我的环境:xcode 8.3.2 xcode-select 的就是 8.3.2 的。本地还有另一个 xcode7
我在执行 brew install --HEAD libimobiledevice -g 的时候报错
附上报错截图

排查了一下错误信息,

我本地还是有 MacOSX10.12.sdk 的只是 MacOSX.sdk 的替身存在

另外我查了一下我的 clang

好像貌似也没有什么问题

autoconf 的版本也是官网要求的版本

在网上搜了很久,没找到解决方案,所以求助一下~

ios11.4.1 的按照下面的命令执行了还是会报 could not connect to lockdowd ,error code -3,大神们知道为什么吗
11018 brew uninstall ideviceinstaller -g
11020 brew uninstall libimobiledevice -g
11021 brew install --HEAD libimobiledevice -g
11022 brew install ideviceinstaller -g
sudo chmod -R 777 /var/db/lockdown

恒温 回复

brew uninstall ideviceinstaller -g
brew uninstall libimobiledevice -g
brew install --HEAD libimobiledevice -g
brew install ideviceinstaller -g
sudo chmod -R 777 /var/db/lockdown
用了这几条命令,且去/var/db/目录下的 lockdown 查看了相关权限,已修改为 everyone 可读可写
Mac 版本:10.13.1 (17B1003)

在执行 ideviceinstaller -l 时依然提示:Could not connect to lockdownd. Exiting.
求帮忙

匿名 #22 · 2018年11月13日

感觉已经被苹果封掉了,获取其他的 app 的 bundle id 对于苹果是比较危险的事情

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册