What is UIATargetHasGoneAWOLException while operating iphone with UIAutomation through Instruments.

╄→尐↘猪︶ㄣ 提交于 2019-12-06 13:15:37

I've found that this occurs when certain unknown conditions exist AND an iPhone is connected to the computer. Disconnecting the iPhone will solve the problem.

Unfortunately, I don't know what the "certain unknown conditions" are, because a connected iPhone device doesn't automatically result in this exception. But I do see that disconnecting the iPhone is sufficient to prevent it.

I found this article that gives a great explanation for UIATargetHasGoneAWOLException, and his solution worked for me.

Basically, the generated Info.plist file inside your .app is missing some attributes. I was able to add the following to my Info.plist and it worked as expected:

    <key>CFBundleSupportedPlatforms</key>
    <array>
            <string>iPhoneSimulator</string>
    </array>
    <key>DTPlatformName</key>
    <string>iphonesimulator</string>
    <key>DTSDKName</key>
    <string>iphonesimulator6.0</string>
    <key>UIDeviceFamily</key>
    <array>
            <integer>1</integer>
    </array>

Btw, Xcode by default builds your .app binary in ~/Library/Application Support/iPhone Simulator/6.1/Applications/..., where ... is some random ID string that Xcode generates. Once you locate the right Application directory, right click on your .app file and Show Package Contents. In there, you'll find the Info.plist file where you can add the above code.

You can find a good documentation on Apple Website explaining when this exception is thrown :

Apple UIATarget Class - Exception

I hope it will help you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!