16

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!

Maciej Swic
  • 11,139
  • 8
  • 52
  • 68

2 Answers2

14

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.

Caleb
  • 124,013
  • 19
  • 183
  • 272
  • 1
    Yes, this is a valid workaround, recommended by the Apple folks themselves for some of the DTrace modules within Instruments - hence this is a known issue. – Till Jun 14 '11 at 19:06
  • 6
    Doesnt work for me. Attach to Process menu says "This instrumentation disallows attach". – Maciej Swic Jun 15 '11 at 14:47
  • 1
    If i choose the Activity Monitor instrument, i can attach to the process, but Allocations or Leaks both say This Instrumentation Disallows Attach – Maciej Swic Jun 15 '11 at 14:55
  • That makes sense -- you can start sampling anytime, but if you're keeping track of memory you have to start from the beginning. Memory management works the same on the simulator as it does on the device, though, so Leaks and Allocations should give you the same results on the simulator that you get on the device. That's certainly not ideal, but maybe it's enough to help you work. – Caleb Jun 15 '11 at 15:17
  • More research: If i choose the Leaks instrument, then remove the Allocations component form it, i can then attach to a running process on the device, but it displays leaks ONLY, no responsible frame or stack trace which makes it impossible to locate the leak. Choosing a different instrument at launch of Instruments allows me to manually attach to a running process, but Xcode doesnt launch the process for me so still no stack trace information etc. Help! – Maciej Swic Jun 15 '11 at 15:53
  • No answer, but similar issue. Within system.log this entry is shown (similar follow): `Instruments[38216]: AMDeviceStartSession (thread 0x7fff703d0ca0): Could not start session: kAMDInvalidPairRecordError` Attaching to the process is possible (for cpu), but launching from Xcode with leak/allocation is not. – marcus Jun 15 '11 at 19:40
  • Just found a working solution for me from this [SO answer](http://stackoverflow.com/q/6297554/439489). If Xcode 4.2 latest dev build is installed, the non-dev-build Instruments.app seems to have issues. If I directly start the instruments.app of the latest XCode4.2 Dev Build, I can select _Choose Target_ and successfully do leaks and allocatiosn profiling. – marcus Jun 15 '11 at 20:18
  • Undortunately this app relies on the camera very heavily, so the sim is not an option. – Maciej Swic Jun 16 '11 at 11:42
  • I had the new Xcode installed before removing it. I guess thats the problem then. Any ideas please? – Maciej Swic Jun 16 '11 at 11:44
  • 1
    @Maciej Swic Can you (re)install latest Xcode 4.2 Beta next to the current XCode and just start the Xcode 4.2 Instruments.app (You don't even need to run Xcode)? I did **not** update my device to iOS5, I just use the Instruments app of the Xcode 4.2 to do profiling for leaks/allocations. – marcus Jun 16 '11 at 18:22
  • 1- Run the app on simulator 2- Open Debug Navigation (Command + 7) 3- Click on CPU 4- Click on “Profile in Instruments” – Mamad Farrahi Mar 15 '20 at 08:08
5

I had the same problem, my solution was to initiate instruments from XCODE.

Xcode 11:

  1. Run the app on simulator

  2. Open Debug Navigation (Command + 7)

  3. Click on cpu

  4. Click on “Profile in Instruments”

enter image description here

Xcode 3.2.5

  1. Launch XCODE

  2. Select Device, or Simulator

  3. 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

NebulaFox
  • 7,813
  • 9
  • 47
  • 65
Louie
  • 5,920
  • 5
  • 31
  • 45
  • 3
    Product > Profile didn't work for me either. Same problem as the OP, except there's no console message. It just sits there, and Xcode's "LCD" says "Finished running - Profiling". – Oscar Jan 30 '12 at 22:25
  • I had a similar problem with Xcode 9, asking instruments to launch the app on the simulator was giving me a blank screen, based on your idea I opened the Debug Navigator (command+7), selected memory consumption and asked to transfer the app to instruments. Weird and not ideal, but worked. – Hola Soy Edu Feliz Navidad Oct 23 '17 at 08:37
  • Sorry, actually it didn't work, the app crashed whenever I started interacting with it. – Hola Soy Edu Feliz Navidad Oct 23 '17 at 08:39