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.\"
On devices you should explicity allow to run UI Automation scripts.
Settings -> Developer
Enable UI Automation
After turning the option on, the error went away and everything worked as expected.