iOS 测试 iOS9.3 target.shake () 自动化问题

gaonan1212 · 2016年05月06日 · 最后由 Droid roll 回复于 2016年05月07日 · 1220 次阅读

先帖 js 代码:

var target = UIATarget.localTarget();
target.delay(3);
target.shake();
target.delay(5);

我在 app 实现了摇一摇的具体操作,摇手机能看到效果,但是使用 instruments 执行自动化测试,shake()没反应,没有触发我的摇一摇,查看苹果官方文档:

Simulates a shake action on the device.

Declaration (undefined) shake() Discussion The shake action triggers a
UIEvent of type UIEventSubtypeMotionShake, but does not affect the
accelerometer itself.

Availability

这里只说会触发 UIEventSubtypeMotionShake,我的摇一摇在 delegate 里试过不行,写 UIWindow 的 category 也是一样效果,是不是摇一摇实现的位置不对?有人用过这个 target.shake() 么?求助。

共收到 2 条回复 时间 点赞

使用 markdown 编辑帖子

使用 markdown 编辑帖子

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