When I try to run a UI Automation script on iOS 5 devices I am getting the following error:
"An error occurred while trying to run the script."
The same script is running perfectly in the simulator or on an iOS 4.3.3 device.
How can I solve this problem?
Might be you are having more than one Xcode in your machine either delete others or Just follow these steps
1 Open Xcode and go to its preferences. 2 Then open Location tab 3 In command line tools select the Xcode version that you are using . it might be possible that this entry is wrong
On devices you should explicity allow to run UI Automation scripts.
Settings -> Developer
Enable UI Automation
to onAfter turning the option on, the error went away and everything worked as expected.
I would try closing xcode and starting the automation script without xcode running. I had an issue where the process was attached to xcode, when I attempted to run from instruments, xcode got stuck on a breakpoint/crash and I couldn't proceed.
The solution I'm proposing is run Instruments independent of xcode.
This should fix this issue: