㈠ 如何在 iOS 真机运行 Appium 社区 TesterHome
首先 Appium 支持 iOS 真机
以下条件必须满足:
苹果开发者账号和开发者证书
苹果设备,确保这个设备已经被配置为开发机器。怎么配置?
签名过的 .ipa 文件或者源代码
A Mac with Xcode and the Xcode Command Line Developer Tools,有 xcode和xcode command line 的 苹果系统。别来问我,windows 怎么测试 iOS 应用。
Provisioning Profile
再次强调真机需要有效的开发分发证书和开发的 Provisioning Profile。
你的应用需要签名。Appium 会参试使用 Fruitstrap 安装应用。
但是使用 xcode 安装到真机会方便很多。
拓展: 什么是 Provisioning Profile?
运行
要指定真机运行有两种方式:
appium 启动的时候,指定 udid 和 app bundle appium -U <udid> --app <path or bundle>
或者在脚本里指定两个 desired capability
desired_capabilities={
'app':'com.xxx.iphone',
'udid':'',
'platformName': 'iOS',
'deviceName': 'iPhone'
})
注意: 如果设备中未安装 app 可以指定 ipa 地址,如果安装了,
则指定 bundle ID。
㈡ 明明就是iOS系统的,结果微信要安装苹果定制版的居然提示这个,求助怎么回事,有谁知道的求告知
您好!很高兴能为您解答, 拒绝 iOS 应用获取设备的 UDID的原因
UDID本来是为了方便一个应用来统计用户行为的,但是因为是一个唯一ID,而且直接看不到跟用户隐私的关系,所以是开放出来的。但是,当有大量的App在市场中,而UDID对于每个App都是一样的时候,用户的隐私其实受到了一定程度的侵犯。假设有很多App联合在一起,因为UDID是统一的,那么他们就可以拼凑出用户的隐私出来。所以从这个角度苹果去掉了UDID的支持,而每个应用可以自行生成自己的UUID,所以,单一app的统计仍旧不会发生问题。所以主要的原因是隐私问题。
、必须使用UDID时建议的UUID替代方案
-(NSString*) uuid {
CFUUIDRef puuid = CFUUIDCreate( nil );
CFStringRef uuidString = CFUUIDCreateString( nil, puuid );
NSString * result = (NSString *)CFStringCreateCopy( NULL, uuidString);
CFRelease(puuid);
CFRelease(uuidString);
return [result autorelease];
}
苹果公司建议采用上述代码为应用生成唯一标识字符串。开发者可以在应用第一次启动时调用一次,然后将该串存储起来,以便以后替代UDID来使用。显而易见,这种方法问题很多。如果用户删除该应用再次安装时,又会生成新的字符串,所以不能保证唯一识别该设备;如果你从一台旧设备中备份文件到新设备中,两台设备就拥有相同的CFUUID;如果你从临时文件中备份操作系统,就会出现一个设备里存在不同CFUUID的情况。
2、使用开源方案OpenUDID
贡献者在readme文档中说:
OpenUDID is a drop-in replacement for the deprecated [UIDevice uniqueIdentifier] a.k.a. UDID on iOS, and otherwise is an instry-friendly equivalent for iOS and Android.
The agenda for this community driven project is to: – Provide a reliable proxy and replacement for a universal unique device identifier. That is, persistent and sufficiently unique, on a per device basis. – NOT use an obvious other sensitive unique identifier (like the MAC address) to avoid further deprecation and to protect device-level privacy concerns – Enable the same OpenUDID to be accessed by any app on the same device – Supply open-source code to generate and access the OpenUDID, for iOS and Android – Incorporate, from the beginning, a system that will enable user opt-out to match Apple’s initial intent.
愿景很好,也确实没有用到MAC地址,同时能保证同一台设备上的不同应用使用同一个OpenUDID。但是仔细分析,还是能发现问题。
unsigned char result[16];
const char *cStr = [[[NSProcessInfo processInfo] globallyUniqueString] UTF8String];
CC_MD5( cStr, strlen(cStr), result );
_openUDID = [NSStringstringWithFormat:
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%08x",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15],
arc4random() % 4294967295];
这里使用了NSProcessInfo类。
当设备上第一个使用OpenUDID解决方案的应用第一次调用时,确实会生成一个唯一的识别码。同时,为了与官方的UDID位数相同,还在MD5值后面追加了8位随机码。然后,该方案使用到了NSUserDefaults类(应用设置)。应用将获取到的唯一识别码保存到应用的UserDefaults中,如果程序以后需要使用唯一识别码,就从UserDefaults中获取,这样就保证可以拿到同一个识别码。但是,如果用户删除了应用,UserDefaults同样会被清空,为了避免重新生成唯一识别码,该方案还使用到了UIPasteboard类(设备剪切板)。应用在将唯一识别码保存到UserDefaults的同时,也会将其保存到以特殊的key标识的UIPasteboard中。代码如:
1
2
UIPasteboard* slotPB = [:availableSlotPBid create:YES];
[slotPB setData:[NSKeyedArchiver archivedDataWithRootObject:dict] forPasteboardType:kOpenUDIDDomain];
其中availableSlotPBid是一个字符串key,前缀是“org.OpenUDID.slot.”,点后面加上数字。这个数字默认是从0到99(当然你可以修改源代码使它更大或者更小)。
如果设备上安装了第二个使用OpenUDID解决方案的应用,当应用调用生成OpenUDID的方法时,将会从UIPasteboard中获取唯一识别码(遍历key从0到99的UIPasteboard),这里取到的就是之前第一个应用保存到UIPasteboard中的。也就是说,只要用户设备上有一个使用了OpenUDID的应用存在时,其他后续安装的应用如果获取OpenUDID,都将会获得第一个应用生成的那个。
看起来似乎很好,很复杂。但是仔细想想,还是有问题,如果把使用了OpenUDID方案的应用全部都删除,再重新获取OpenUDID,此时的OpenUDID就跟以前的不一样了(本人测了一下,确实如此)。可见,这种方法还是不保险。
3、开源方案SecureUDID
稍微看了下SecureUDID源码,发现其与OpenUDID其实差不多,只是初始获取的唯一识别码稍有不同。同时,从作者的Readme文档中可见,这个方案同样存在很多问题。如原文:
Is this a true UDID replacement?
SecureUDID has two properties that you should know about before you use it. First, as indicated above, the identifier is not derived from hardware attributes. Second, the persistence of an identifier cannot be guaranteed in all situations. This means that, while unlikely, it is technically possible for two distinct devices to report the same identifier, and for the same device to report different identifiers. Consider this carefully in your application. Here is a list of situations where this identifier will not exhibit the uniqueness/persistence of a traditional UDID.
* The user has opted-out of the SecureUDID system, in which case you will receive a well-formed string of zeroes.
* Device A is backed up and then restored to Device B, which is an identical model. This is common when someone breaks their phone, for example, and is likely desirable: you will receive Device A’s SecureUDID.
* The SecureUDID data is removed, via user intervention, UIPasteboard data purge, or by a malicious application.
* The SecureUDID backing store becomes corrupt.
* All SecureUDID applications are uninstalled from a device, followed by a UIPasteboard data purge.
我发现,其实前面的OpenUDID也基本存在以上问题,只是作者没写出来。看来还是SecureUDID的贡献者比较厚道。
4、与WIFI MAC地址相关
网上同样有一些与WIFI MAC地址相关的替代方案,主要分三种:第一种直接使用“MAC Address”;第二种,使用“MD5(MAC Address)”;第三种,“MD5(MAC Address+CFBundleIdentifier)”。github上有个开源项目(UIDevice-with-UniqueIdentifier-for-iOS-5)实现了这几种方法。
使用这种方法也存在问题:1、市面上有部分机器(虽然数量极少,但是本人在使用过程中确实发现过这种情况)无法获得MAC地址,有人说这部分机器是联通阉割无WIFI版的,具体不得而知了。2、MAC地址跟UDID一样,存在隐私问题。苹果现在禁用UDID,不能保证以后不会禁用MAC地址。
5、部分大公司私有的解决方案,但是他们怎么会告诉你呢?
所以,如果你想以一种万无一失的方法追踪某台设备,现在还没有比UDID更合适的选择。但是,苹果现在不让用了,苦逼的开发者们,该怎么办呢?
㈢ 如何在 iOS 真机运行 Appium
首先 Appium 支持 iOS 真机
以下条件必须满足:
苹果开发者账号和开发者证书
苹果设备,确保这个设备已经被配置为开发机器。怎么配置?
签名过的 .ipa 文件或者源代码
A Mac with Xcode and the Xcode Command Line Developer Tools,有 xcode和xcode command line 的 苹果系统。别来问我,windows 怎么测试 iOS 应用。
Provisioning Profile
再次强调真机需要有效的开发分发证书和开发的 Provisioning Profile。
你的应用需要签名。Appium 会参试使用 Fruitstrap 安装应用。
但是使用 xcode 安装到真机会方便很多。
拓展: 什么是 Provisioning Profile?
运行
要指定真机运行有两种方式:
appium 启动的时候,指定 udid 和 app bundle appium -U <udid> --app <path or bundle>
或者在脚本里指定两个 desired capability
desired_capabilities={
'app':'com.xxx.iphone',
'udid':'',
'platformName': 'iOS',
'deviceName': 'iPhone'
})
注意: 如果设备中未安装 app 可以指定 ipa 地址,如果安装了,
则指定 bundle ID。
所以对于第一种情况,代码可以这样写:
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'deviceName':'',
'platformName': 'iOS',
})
对于第二种情况,代码可以这样写:
app = "io.appium.TestApp"
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'deviceName':'',
'platformName': 'iOS',
'app': app,
'udid': ''
})
调试的思路
确保 UDID 的正确,是真机的 UDID。(20+ 字符串)
确保在模拟器上已经能运行无误了。
直接使用 Instruments 看看是否能在真机上运行。有些情况连 xcode 的 instruments 都不能在真机上调试,那更别谈 appium 了
确保运行 appium 用例前, instruments 没有启动过。看看有没有 instruments 的进程。
㈣ 如何在 iOS 真机运行 Appium
首先你启动 appium 的时候 指定设备的 UUID 指定 APP 的 Bundle ID 比如 appium -U --app io.appium 然后再去运行脚本。
比如源码的案例下面的 examples/python/simple_real_device.py
㈤ 如何在 iOS 真机运行 Appium 03 社区 03 TesterHome
首先 Appium 支持 iOS 真机
以下条件必须满足:
苹果开发者账号和开发者证书
苹果设备,确保这个设备已经被配置为开发机器。怎么配置?
签名过的 .ipa 文件或者源代码
A Mac with Xcode and the Xcode Command Line Developer Tools,有 xcode和xcode command line 的 苹果系统。别来问,windows 怎么测试 iOS 应用。
Provisioning Profile
再次强调真机需要有效的开发分发证书和开发的 Provisioning Profile。
应用需要签名。Appium 会参试使用 Fruitstrap 安装应用。
但是使用 xcode 安装到真机会方便很多。
拓展: 什么是 Provisioning Profile?
运行
要指定真机运行有两种方式:
appium 启动的时候,指定 udid 和 app bundle appium -U <udid> --app <path or bundle>
或者在脚本里指定两个 desired capability
desired_capabilities={
'app':'com.xxx.iphone',
'udid':'',
'platformName': 'iOS',
'deviceName': 'iPhone'
})
注意: 如果设备中未安装 app 可以指定 ipa 地址,如果安装了,
则指定 bundle ID。
所以对于第一种情况,代码可以这样写:
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'deviceName':'',
'platformName': 'iOS',
})
对于第二种情况,代码可以这样写:
app = "io.appium.TestApp"
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'deviceName':'',
'platformName': 'iOS',
'app': app,
'udid': ''
})
调试的思路
确保 UDID 的正确,是真机的 UDID。(20+ 字符串)
确保在模拟器上已经能运行无误了。
直接使用 Instruments 看看是否能在真机上运行。有些情况连 xcode 的 instruments 都不能在真机上调试,那更别谈 appium 了
确保运行 appium 用例前, instruments 没有启动过。看看有没有 instruments 的进程。
目前 1.2.2 的坑
目前 appium 1.2.2 上运行 iOS 真机测试的话,可能会遇到如下的错误:
info: [debug] Starting iOS device log capture via deviceconsole
error: iOS log capture failed: spawn ENOENT
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: spawn ENOENT
info: [debug] Error: spawn ENOENT
at errnoException (child_process.js:1000:11)
at Process.ChildProcess._handle.onexit (child_process.js:791:34)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 1780.745 ms - 197
这是因为在 /usr/local/lib/node_moles/appium/build/deviceconsole/ 下面缺失了 deviceconsole。已经有 bug 追踪了。
解决方法如下:
到该目录底下 cd /usr/local/lib/node_moles/appium/build/deviceconsole/
打开这个deviceconsole project。 open deviceconsole.xcodeproj
重新 build 一把。把 build 出来的 deviceconsole,复制到 /usr/local/lib/node_moles/appium/build/deviceconsole/去。
然后重新运行 Appium
注意: deviceName 就算为空也一定要,代码写死的。。。
㈥ 苹果超级签名源码和苹果企业签名有什么区别
首先来简单介绍一下这两种签名方式的原理:
超级签名是使用个人开发者账号,自动化添加苹果设备的udid,实现真机测试。
而企业签名是使用企业开发者账号,通过生成的p12证书,对应用进行签名。
超级签名与企业签名的区别:
1、是否需要越狱?
这两种签名方式都无需越狱。
2、是否需要提供UDID?
对于用户来说,这两种签名方式都不需要主动提供udid,超级签名将获取、注册udid实现了全自动化,用户直接安装即可。
3、安装之后是否需要信任
企业签名的应用,用户在安装时需要先在【设置】-【描述文件】中信任证书。
而超级签名无需信任证书,可以直接安装。
4、稳定性如何,是否会掉签?
超级签名和企业签名都有可能掉签,不过企业签名掉签的频率会多一点,尤其是共享企业签名。
而超级签名掉签的几率比较小,超级签名更加稳定。
5、是否需要提供源码?
两种签名方式都不要提供源码。
6、能否在App Store上搜索到?
两种签名方式都不能在App Store上搜索到。
7、如何收费?
目前市面上的企业签名一般按月收费,超级签名是按照下载量收费。
8、两种签名方式分别适合什么样的APP?
超级签名价格较贵,一般适合用户数量不是很多的APP,而企业签名一般对APP的类型和数量没有限制。
超级签名更加稳定,适合运营初期的APP,提高用户体验,提高用户粘性,稳定忠实用户。
微导流新版本正式上线,在线企业签名
㈦ 如何在 iOS 真机运行 Appium 03 社区 03 TesterHome
首先 Appium 支持 iOS 真机
以下条件必须满足:
苹果开发者账号和开发者证书
苹果设备,确保这个设备已经被配置为开发机器。怎么配置?
签名过的 .ipa 文件或者源代码
A Mac with Xcode and the Xcode Command Line Developer Tools,有 xcode和xcode command line 的 苹果系统。别来问我,windows 怎么测试 iOS 应用。
Provisioning Profile
再次强调真机需要有效的开发分发证书和开发的 Provisioning Profile。
你的应用需要签名。Appium 会参试使用 Fruitstrap 安装应用。
但是使用 xcode 安装到真机会方便很多。
拓展: 什么是 Provisioning Profile?
运行
要指定真机运行有两种方式:
appium 启动的时候,指定 udid 和 app bundle appium -U <udid> --app <path or bundle>
或者在脚本里指定两个 desired capability
desired_capabilities={
'app':'com.xxx.iphone',
'udid':'',
'platformName': 'iOS',
'deviceName': 'iPhone'
})
注意: 如果设备中未安装 app 可以指定 ipa 地址,如果安装了,
则指定 bundle ID。
所以对于第一种情况,代码可以这样写:
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'deviceName':'',
'platformName': 'iOS',
})
对于第二种情况,代码可以这样写:
app = "io.appium.TestApp"
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'deviceName':'',
'platformName': 'iOS',
'app': app,
'udid': ''
})
调试的思路
确保 UDID 的正确,是真机的 UDID。(20+ 字符串)
确保在模拟器上已经能运行无误了。
直接使用 Instruments 看看是否能在真机上运行。有些情况连 xcode 的 instruments 都不能在真机上调试,那更别谈 appium 了
确保运行 appium 用例前, instruments 没有启动过。看看有没有 instruments 的进程。
目前 1.2.2 的坑
目前 appium 1.2.2 上运行 iOS 真机测试的话,可能会遇到如下的错误:
info: [debug] Starting iOS device log capture via deviceconsole
error: iOS log capture failed: spawn ENOENT
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: spawn ENOENT
info: [debug] Error: spawn ENOENT
at errnoException (child_process.js:1000:11)
at Process.ChildProcess._handle.onexit (child_process.js:791:34)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 1780.745 ms - 197
这是因为在 /usr/local/lib/node_moles/appium/build/deviceconsole/ 下面缺失了 deviceconsole。已经有 bug 追踪了。
解决方法如下:
到该目录底下 cd /usr/local/lib/node_moles/appium/build/deviceconsole/
打开这个deviceconsole project。 open deviceconsole.xcodeproj
重新 build 一把。把 build 出来的 deviceconsole,复制到 /usr/local/lib/node_moles/appium/build/deviceconsole/去。
然后重新运行 Appium
注意: deviceName 就算为空也一定要,代码写死的。。。