AppIntents Parameter requestValue not working in iOS 18 when parameter is not in parameterSummary

In iOS 18, the requestValue method no longer works when the parameter it is called on is not included in the parameterSummary of an AppIntent. This issue causes the app to fail to present a prompt for the user to select a value, resulting in an error with the message:

Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 40685 on anonymousListener or serviceListener was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid."

Steps to Reproduce:

  1. Create a simple AppIntent with the following code:
import AppIntents

struct Intent: AppIntent {
    static let title: LocalizedStringResource = "Intent"
    
    static var parameterSummary: some ParameterSummary {
        Summary("Test \(\.$category)") {}
    }

    @Parameter(title: "Category")
    private var category: CategoryEntity?
    
    @Parameter(title: "Hidden Category")
    private var hidden: CategoryEntity?
    
    @MainActor
    func perform() async throws -> some ReturnsValue<CategoryEntity?> {
        var result: CategoryEntity?
        do {
            result = try await $hidden.requestValue("Select category") // Doesn't work since iOS 18 as $hidden is not set in parameterSummary
        } catch {
            print("\(error)")
        }
        
        return .result(value: result)
    }
}
  1. Run the code on a device with iOS 18.
  2. Observe that the requestValue method fails to present the selection prompt and instead throws an error.

Expected Results:

The app should successfully present a prompt for the user to select a value for the hidden parameter using requestValue, even if the parameter is not included in the parameterSummary.

Actual Results:

The app fails to present the selection prompt and throws an error, making it impossible to use requestValue for parameters not included in parameterSummary.

Version/Build:

iOS 18.0

Configuration:

Tested on various devices running iOS 18.

Is there a change in the API that I might have missed?

I'm not able to reproduce this with your code there, though I'm also making assumptions about the category entity and entity query to create a test project. Do you see the same issue with iOS 18 beta 8? If so, I'd like you to share your entity and query as well, in case those are involved.

I also noticed this:

 static var parameterSummary: some ParameterSummary {
        Summary("Test \(\.$category)") {}
    }

You have the trailing curly braces there, which serve no purpose for this snippet. Was that just accidentally left over when you reproduced this to a tester project? I ran my tests with both those braces included and removed.

— Ed Ford,  DTS Engineer

@Feidee, I still can't reproduce this with your examples.

That says to me that if anyone else is encountering this, there's something else going on beyond your code that we will need to investigate further. The best thing to do in this case is to file a bug report. To make it a useful bug, please attach a minimal Xcode test project that you can include to demonstrate the file, as well as a sysdiagnose taken after installing the Intents logging profile. Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

—Ed Ford,  DTS Engineer

Test project added to demonstrate the issue. FB14828592

The issue still exists on iOS18 and beta 18.1.

Entity

import AppIntents

struct CategoryEntity: AppEntity {
    var id: UUID
    var name: String
    
    init(name: String) {
        self.id = UUID()
        self.name = name
    }
    
    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: LocalizedStringResource(stringLiteral: name))
    }
    
    static let typeDisplayRepresentation: TypeDisplayRepresentation = "Category"
    
    static let defaultQuery = CategoryEntityQuery()
}

struct CategoryEntityQuery: EntityQuery {
    func entities(for identifiers: [CategoryEntity.ID]) async throws -> [CategoryEntity] {
        SampleData.categories
    }
    
    func suggestedEntities() async throws -> [CategoryEntity] {
        SampleData.categories
    }
}

struct SampleData {
    static var categories: [CategoryEntity] = [
        .init(name: "Category 1"),
        .init(name: "Category 2"),
        .init(name: "Category 3"),
        .init(name: "Category 4"),
        .init(name: "Category 5")
    ]
}

Intent

import AppIntents

struct Intent: AppIntent {
    static let title: LocalizedStringResource = "Intent"
    
    static var parameterSummary: some ParameterSummary {
        Summary("Test \(\.$category)") {
            /// $hidden.requestValue() functions properly when it is included in the ParameterSummary
            // \.$hidden
        }
    }

    @Parameter(title: "Visible Category")
    var category: CategoryEntity?
    
    @Parameter(title: "Hidden Category")
    private var hidden: CategoryEntity?
    
    @MainActor
    func perform() async throws -> some ReturnsValue<CategoryEntity?> {
        let visible = try? await $category.requestValue("Select visible category") // Works as expected
        
        var hidden: CategoryEntity?
        /// Fails since iOS 18 because $hidden is not part of the ParameterSummary
        do {
            hidden = try await $hidden.requestValue("Select hidden category")
        } catch {
            /// Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 11647 on anonymousListener or serviceListener was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." UserInfo={NSDebugDescription=The connection from pid 11647 on anonymousListener or serviceListener was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.}
            print(error)
        }
        
        let value = hidden ?? visible
        print("Category: \(value?.name ?? "none")")
              
        return .result(value: value)
    }
}
AppIntents Parameter requestValue not working in iOS 18 when parameter is not in parameterSummary
 
 
Q