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)
}
}
Post
Replies
Boosts
Views
Activity
Test project added to demonstrate the issue.
FB14828592
I'm encountering the same issue, but it seems to have stopped working, likely since iOS 17.
https://developer.apple.com/forums/thread/765516
FB14035016