Appium appium safari 真机启动 The app must be signed with a development identity (e.g. iOS Developer).

kristina · 2015年03月17日 · 最后由 cool 回复于 2017年12月28日 · 1876 次阅读

配置环境:

Mac :10.10.2
appium :1.3.6
ios:iphone 6 iOS 8.1

JAVA 配置代码

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability("deviceName", "iPhone 6");
        desiredCapabilities.setCapability("platformName", "iOS");
        desiredCapabilities.setCapability("platformVersion", "8.1");
        desiredCapabilities.setCapability("app", "/Users/Kristina/Desktop/SafariLauncher.ipa");  
        desiredCapabilities.setCapability("udid","...........设备号....");
        URL url = new URL("http://127.0.0.1:4723/wd/hub");
        driver = new RemoteWebDriver(url, desiredCapabilities);

appium log 内容

[INST STDERR] 2015-03-17 11:14:30.835 instruments[1829:83101] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: Permission to debug com.dooioo.safariLauncher was denied. The app must be signed with a development identity (e.g. iOS Developer).
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] Killall iOS Simulator
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID .............
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w ccc918011e6404e43e30ca18ead232b6d4e84e90 com.dooioo.safariLauncher -e UIASCRIPT "/Users/Kristina/Library/Application Support/appium/bootstrap/bootstrap-0b4d5830daa12b26.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {"global":90000}

证书之类的已经安装成功,通过 itunes 也能正常安装 SafariLauncher.ipa 该 app,但是通过脚本启动就发生上述错误,启动失败
Google 之后,发现网上有大致有三种解决方案,但是实在理解能力有限,不太明白所说的内容:
1.修改 Entitlements Plist 文件的 get-task-allow 属性为 true(https://discuss.appium.io/t/the-app-must-be-signed-with-a-development-identity/2653/2)。这个文件我已经创建成果,但是该添加在什么地方,不是很清楚
2.https://github.com/appium/appium/issues/3947 该问题和我的问题一模一样,看到最后的解决方案时 use this: https://github.com/appium/appium/blob/master/bin/ios-webkit-debug-proxy-launcher.js. 这个 js 我看了 我安装的 appium 路径下也有该文件,但他所说的是 “use” 是如何使用呢?也不是很清楚
3.最后一种也是我和我从 log 表面分析的,是证书问题,使用 developer 证书,因为现在用的是 adhoc 的证书,但开发者发布都是用的 adhoc 证书,试着选择 developer 证书后无法进行打包。

看了网上这么多有这种错误,自己却始终没解决,也够郁闷了,希望有人能帮忙解决~

共收到 9 条回复 时间 点赞

关于第二个解决方案,那个 js 文件的注释不就写了怎么运行嘛:

/*
 * Small tool, launching and monitoring ios-web-kit-proxy, and relauching
 * on predefined errors.
 *
 * Usage:
 *  ./bin/ios-webkit-debug-proxy-launcher.js [args]
 *  args: ios-webkit-debug-proxy args (they will be passed over)
 *
 * Example:
 *  ./bin/ios-webkit-debug-proxy-launcher.js -c <UDID>:27753 -d
 *
 *  Note:
 *   For iOS8.1 try this first:
 *     brew install --HEAD ideviceinstaller
 */

就是装了 node.js 后,运行./bin/ios-webkit-debug-proxy-launcher.js [args](这里的路径你自己知道怎么改了吧,参数列表请看https://github.com/google/ios-webkit-debug-proxy说明)。如果是 iOS 8.1,先用brew install --HEAD ideviceinstaller安装 ideviceinstaller 后再运行ios-webkit-debug-proxy-launcher.js

然后建议你完整阅读这里的文档先:
https://github.com/testerhome/appium/tree/master/docs/cn/appium-setup

解决问题建议首先查文档,然后找官方论坛,然后 google,最后发帖。

因为他测试的 iOS 真机的 webview,所以出现这个问题了。小白问题。

#2 楼 @lihuazhang ? 没有 webview 啊,用的就 safari

#1 楼 @chenhengjie123 嗯,流程有点不对,多谢提点。 那个已经试验过,依然启动失败,我再看看别的方法

safari 不就是网页么?webview 就是指网页视图不是。。。

不能用发布证书,必须要用开发者证书!

不明白你选择开发者证书后为什么打包失败!

#6 楼 @mildshark 对的, 后来用开发者证书打包是成功的,但是使用这个打的包仍然出现这个问题。只有通过源码直接编译到真机上的话,就不会出现这种问题,能正常启动。

#5 楼 @doctorq 😄 我以为 lihuazhang 说的是 webview 这种方式驱动 safari,我用的是 safarilauncher 这种方式驱动的~

kristina 回复

请问为什么不能用发布证书,只能用开发者证书呢

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