Profiling iOS apps on M1 with Instruments xctrace invalid code signature

I'm trying to profile app launch of an iOS app running on an M1 Mac. After downloading a Mac compatible app from the iOS App Store (Airbnb) I'm able to select it in instruments by selecting the .app in /Applications

This allows me to launch the app and profile it by pressing the record button

Now I want to do this in an automated way with xctrace so I ran :

xcrun xctrace record --template 'App Launch' --device CE3D229D-A2BF-5455-8923-5D49498F06DC --launch -- '/Applications/Airbnb.app'

Using the id of my Mac returned from xcrun xctrace list devices. This attempts to launch the app but it immediately crashes with an error about an invalid code signature:

If I try the same process with a MacOS app like Twitter, instead of an iOS app running on Mac, I'm able to launch it with xctrace. I'm also able to attach to Airbnb using the --attach PID option, but this doesn't help for testing app launch.

I also tried launching the internal iOS .app using: xcrun xctrace record --template 'App Launch' --device CE3D229D-A2BF-5455-8923-5D49498F06DC --launch -- '/Applications/Airbnb.app/Wrapper/Airbnb.app' but got the same crash.

How can I use the command line to launch an iOS app for profiling instruments?

This is using Xcode 12.5.1 on macOS 11.5.2

I would not expect this to work. Apps that you download from the store have the get-task-allow entitlement set to false [1] and, as such, can’t be run under the debugger (or, equivalently, but xctrace).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Well, more typically, they have no get-task-allow entitlement and, for iOS apps, no entitlement triggers a default of false.

Any idea why it would still not work for locally signed apps packaged as iOS apps running on Mac?

No, sorry. I’m not really up-to-speed on the whole iOS Apps on Mac story.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Profiling iOS apps on M1 with Instruments xctrace invalid code signature
 
 
Q