Calling .spotlightQuery() using AppIntentsTesting results in a crash on Xcode 27 beta 1

On https://developer.apple.com/documentation/AppIntentsTesting/testing-your-app-intents-code

Apple showcases the following example using AppIntentsTesting to query entities indexed in spotlight. For me, calling .spotlightQuery on any entity definition causes a crash.

func testAllEventsIndexed() async throws {
    let eventDef = definitions.entities["EventEntity"]
    let allIndexed = try await eventDef
        .spotlightQuery(nil)
    XCTAssertGreaterThanOrEqual(allIndexed.count, 3)
}

Crash:

expression unexpectedly raised an error: Failed to obtain the result of the distributed invocation after it was executed. Remote threw executionPermissionDenied(requestBundleID:

Is anyone else seeing this crash, or is it just me?

Thanks!

Thanks so much for the post. Can you provide a run down of he beta versions you are using for you macOS, Xcode and iOS?

This error occurs because the test runner process (xctest) is attempting to make a call to the Spotlight/AppIntents, but the system blocks it because the test runner lacks the correct application context, bundle ID, or entitlements to execute that query? Do you have a project that we can review as well as the crash file and output?

Are you running without a host app? How are you running the test code? So is it running in a generic process that does not inherit your app's bundle ID?

Are you running on the simulator or on a device? Try running this specific test on a physical device.

Let me know. Hope this helps.

Albert  WWDR

Hi Albert,

Thank you for your reply. Yes I was able to reproduce this with a sample project and have provided it in a feedback: FB23222130.

macOS 26.5.1 (25F80)

Xcode 27 Beta 1 27A5194q

iOS 27.0 Beta 1

I'm not doing anything out of the ordinary, just did the exact steps shown in the WWDC video on AppIntentsTesting. It runs in a UI test runner that utilizes the main app target, just as shown. Other AppIntentsTesting modalities seem to work fine.

Sometimes the above code sample will execute with the error I provided, but I have also seen a crash in it which no specific error information is output.

I am running on a sim and will test on device. I will note a separate issue: that because these tests are invisible, you can't witness anything happening on screen, however, Device Hub will be forced as the front window each time a test attempts to execute. I get why this happens but I personally don't love this behavior. I may file a separate feedback on that.

I had some provisioning issues I needed to sort out with my developer account, but once I was able to test on device again, I confirmed that this issue seems to only affect the simulator.

Looks like you filed a bug about it already with the simulator issues. Thanks for the FB number, I'll route it to the correct team and I'll let that team communicate with you over the Feedback Assistant.

You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.

For more details on when you'll see updates to your report, please see What to expect after submission.

Albert  WWDR

Calling .spotlightQuery() using AppIntentsTesting results in a crash on Xcode 27 beta 1
 
 
Q