I am using UIAutomation, through Instruments from Xcode, to do something on iPhone, and got a weird exception: UIATargetHasGoneAWOLException.
Anybody know what does this exception mean?
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
来源:https://stackoverflow.com/questions/9642694/what-is-uiatargethasgoneawolexception-while-operating-iphone-with-uiautomation-t