Is there any way to tell programatically if the app is running on the simulator with an instruments session attached to it?
If not, what would be the best way to do something special in the app (e.g. skipping user sign up) when running UI Automation tests?
In Xcode go to the Product menu and select Edit Scheme. On the left side, select the Profile row. On the right side select the Arguments tab. Turn off the “Use the Run actions…” checkbox.
Now add an argument under “Arguments passed on launch” such as “-profile”.
In your app, in some place you want to check for this flag, you can do something like:
This check, as-is, will work on the simulator and a real device. If you only want this code for simulator and not when you profile on a real device, then wrap the code with: