Why won't instruments execute my Monotouch application? - iphone

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?

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.

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.

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

How about launching Instruments from inside XCode? If you're using Xcode 3, it's in the Build menu and then Run with performance tools. This will fire up Instruments and automatically start recording.

Related

use xcode to instrument/profile third-party app

Is it possible to use Xcode Instruments to profile a third-party app? Right now, whenever I trying to profile any third-party app installed on device, I got error saying
'Target failed to run: Remote exception encountered: failed to get task for pid '
Is there any settings that need to be configured?
From Apple documentation: For your protection, the instrument does not allow you to process any application that is not code-signed with your provisioning profile. This includes any copy that has been downloaded from the iTunes App Store.
UPDATE
As of more recent versions of iOS, you can only attach the profiler to your own developer-signed apps.
ORIGINAL
Using Xcode 4.4.1 and my iPad 3 running iOS 5.1.1, I'm able to use the Core Animation and Time Profiler instruments on third-party apps. I tried it with Twitter and Minecraft PE.
The profiles are rather useless since I don't have symbols for the apps. I just get a lot of addresses in hex. And Instruments won't even show me the disassembly of the apps. I believe this is because iOS, for security, doesn't allow Instruments (or gdb or lldb) to look at the address space of apps installed from the App Store.

Cant launch iOS app with Instruments on device

App installs, Instruments launch, but drop down in instruments says select target, and the app never launches. Console says
6/14/11 2:36:22 PM Instruments[1951] XRMobileDeviceException while performing application lookup on device : (null)
Device is iOS 4.3.3, regular build and run works and no warnings from Xcode. Profile just doesnt work. Tried cleaning the build, restarting Mac OS and the device. Still no go!
I had the same problem. I didn't solve it, but an easy workaround is to launch the app yourself and then attach to it from the Attach to Process... command in the Target menu in the Instruments window.
I had the same problem, my solution was to initiate instruments from XCODE.
Xcode 11:
Run the app on simulator
Open Debug Navigation (Command + 7)
Click on cpu
Click on “Profile in Instruments”
Xcode 3.2.5
Launch XCODE
Select Device, or Simulator
Up on top Click RUN > RUN WITH PERFORMANCE TOOL > LEAKS
This allowed me to test without giving me that error.
This is in XCODE 3.2.5 that I did this in .. it might be a little different if you are using 4.x

Steps to test iphone app on device (profile/certificate already created)

I want to test my app on my itouch which has ios 4.2.1 .
I have completed the steps for provisioning profile/certificate. So under Organizer,
when I select my device, I am seeing the provisioning profile
and under Developer profile, I see 2 entries; iPhone Developer and iPhone Distributor
Now I want to just test the app on my device (NOT looking for steps to submit the app for distribution at this stage)
I think there are some Project settings that I need to do under XCode. But I am unable to figure it out. Please provide me the steps to test on device.
My XCode ver is 3.2.5
I was hitting an issue following this and the documentation where my app would not deploy to my iPhone 3G running iOS 4.2.1 using XCode 4.2. I hope this helps others who end up on this question trying to get their apps to deploy to a real device through XCode.
I kept fiddling with the Base SDK setting along with the Deployment Target setting in the project and target settings area. However, I had them correct to start with so that wasn't the answer (I want to target iOS 3.2+, so I kept all set to that). In addition, I messed with the provisioning profiles, certificates, etc. multiple times even though they looked right to me. They weren't the issue, either.
The key was changing the architecture settings that are scattered throughout the interface.
First, since I am testing it on an iPhone 3G, I needed to support the armv6 architecture as well as armv7 for later models. So I added "armv6" to the "Valid Architectures" entry on the project's "Build Settings" tab.
Next, I made sure it was showing "armv6 armv7" under "Architectures" in the "Build Settings" tab of the target for my project.
Finally, I clicked on the -Info.plist file for my project and removed the "armv7" entry for the "Required device capabilities" that is put there by default for new projects in XCode 4.2.
After this, my app ran successfully on the device using Command + R for Run.
Double click your app under targets in Xcode
Make sure that for the configuration 'Development' you have the right development provisioning
profiles selected.
click on the properties tag and make sure that the identifier is the same as the identifier used in
the development profile.
clean all targets, in Xcode make sure you are building for Device, Debug, and than click 'build and run'.
If the development profile is on your iPhone and you have installed it into Xcode correctly it should work. However sometimes after installing a profile on your iPhone it doesn't register everywhere it needs to and I have found that this is fixed by restarting the iPhone (not Xcode).
Good luck.

Error from Debugger: The program being debugged is not being run

Please dont mark this as duplicate
I am getting this error while debugging my app on device I tried everything from these posts (see below) but no luck -
iPhone SDK- Error from Debugger: The program being debugged is not being run
XCode fails to run app on device, saying the program being debugged is not being run
Can I not run two app with the same build identifier? I use one identifier yesterday to debug one app. Now I am using the same identifier to debug another app on device.
I have tried following -
1) restart mac and iphone
2) reinstall the provision profile (both from xcode and itunes)
Please help!
You can run two app with the same build id. Are you using a distribution profile or development profile?
OK... I got it!
I have to remove the previous app from xcode organizer. Its working now!!

iPhone Debugging Error launching remote program: failed to get the task for process 907

Created an app for adhoc distribution and installed on iphone but it is not working on the installed iphone,Tried connecting the iphone to mac and debug the app but it throws up error stating
" Error launching remote program: failed to get the task for process
907."
is there a way to debug the adhoc distribution provision file from xcode
No, you can't debug an AdHoc build in XCode--setting get-task-allow to FALSE in your Entitlements.plist basically says "don't allow the debugger to connect to this", and is required for AdHoc and AppStore builds.
See
What does get-task-allow do in Xcode?
or the documentation...
I started having this error in my projects in XCode 4.2, and had a tough time figuring it out with the new project layout.
Make sure you go into the Project Settings and change the Code Signing Identity to a development profile for the Debug setting in the target settings. It's a bit easy to miss because the Project settings come up first, and there are identical looking Code Signing Identity settings there. But Target settings trump Project settings.
If that still doesn't work in XCode 4.2, go to "Edit Schemes" - in the project drop down, which is just to the right of the stop button, in the left segment of that custom pop-up. Select "Run" and make sure Build Configuration is set to "Debug".
In prior versions of XCode, it used to tell you whether you were in debug or release right up front; I haven't found where it's that obvious with the new "Schemes".
Restarting the xcode worked fine for me