Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't instruments execute my Monotouch application?

I'm trying to use Instruments to look at resource usage in my Monotouch app. However, I can't get the app to launch through Instruments.

When I hit the record button in Instruments, the app launches on my iPhone, buzzes (signifying it's a debug build), then crashes - and Instruments reports:

Target failed to run: Remote exception encountered : 'Failed to get task for pid 384'

The app runs fine when I launch it directly on the phone.

I've tried it with debug builds and ad hoc builds (using the parameters defined on the Monotouch support page). Always the same.

I'm using Monotouch 3.2.5, iOS 4.3.1 (on a 3GS), Xcode 4 and Snow Leopard.

I've see this issued mentioned in a few places around the web, but haven't seen a resolution. Anyone know how to resolve it?

like image 593
dommer Avatar asked Mar 26 '11 12:03

dommer


3 Answers

It's a signing problem: to run under the control of Instruments, the app is compiled with the Release build settings, not the Debug build settings, which usually means the app is signed with your Distribution certificate instead of your Developer certificate. The app needs to be signed with a Developer certificate for Instruments to be able to control it. Change your signing option to Developer on the Release build and you should be fine.

like image 195
Guy Moreillon Avatar answered Nov 07 '22 05:11

Guy Moreillon


I also ran into this issue with Xcode 4. What worked for me was...

From Xcode 4, run on the connected iOS device. Launch the Instruments app manually. Choose my template (in this case TIme Profiler). Choose my app from the Target menu (to the right of the Record button). Click the Record button.

The suggested Entitlements solution did not work for me (since Entitlements are evidently no longer required in Xcode 4).

The suggested signing solution did not work either. Also, it would be inconvenient to change this every time I wanted to test with Instruments.

like image 35
lifjoy Avatar answered Nov 07 '22 06:11

lifjoy


Check your Entitlements.plist for the signed app. If get-task-allow is false, it will prevent Instruments from attaching to the process.

like image 2
Stuart Carnie Avatar answered Nov 07 '22 06:11

Stuart Carnie