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

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