Swiftui App Intent löst Fehler bei, wenn die RequestDisambiguation mit @Parameter Property Wrapper verwendet wirdIOS

Programmierung für iOS
Anonymous
 Swiftui App Intent löst Fehler bei, wenn die RequestDisambiguation mit @Parameter Property Wrapper verwendet wird

Post by Anonymous »

Ich implementiere eine App -Absicht für meine iOS -App, mit der Benutzer Reiseaktivitäten planen können. Es funktioniert nur, wenn es als Verknüpfung ausgeführt wird, aber keine Stimme durch Siri verwendet. Es gibt 2 Ausgaben: < /p>

Die Verknüpfungsstrepentität akzeptiert nur einen Spracheingang für eine
-Spriors, jedoch nicht für andere. Wie
behelde ich diese Probleme? Tatsächliches Verhalten: Siri akzeptiert nur die gleiche Reise, wenn sie gesprochen hat, aber bei Auswahl durch Klick /Berührung akzeptiert. Aber hier ist der relevante Code: < /p>

Code: Select all

   struct PlanActivityTestIntent: AppIntent {
@Parameter(title: "Activity Day")
var activityDay: ShortcutsItineraryDayEntity

@Parameter(
title: "Trip",
description: "The trip to plan an activity for",
default: ShortcutsTripEntity(id: UUID().uuidString, title: "Untitled trip"),
requestValueDialog: "Which trip would you like to add an activity to?"
)
var tripEntity: ShortcutsTripEntity

@Parameter(title: "Activity Title", description: "The title of the activity", requestValueDialog: "What do you want to do or see?")
var title: String

@Parameter(title: "Activity Day", description: "Activity Day", default:  ShortcutsItineraryDayEntity(itineraryDay: .init(itineraryId: UUID(), date: .now), timeZoneIdentifier: "UTC"))
var activityDay: ShortcutsItineraryDayEntity

func perform() async throws -> some ProvidesDialog {
// ...other code...
let tripsStore = TripsStore()

// load trips and map them to entities
try? await tripsStore.getTrips()
let tripsAsEntities = tripsStore.trips.map { trip in
let id = trip.id ?? UUID()
let title = trip.title
return ShortcutsTripEntity(id: id.uuidString, title: title, trip: trip)
}

// Ask user to select a trip. This line would doesn't accept a voice       // answer. Why?
let selectedTrip = try await $tripEntity.requestDisambiguation(
among: tripsAsEntities,
dialog: .init(
full: "Which of the \(tripsAsEntities.count) trip would you like to add an activity to?",
supporting: "Select a trip",
systemImageName: "safari.fill"
)
)

// This line throws an error
let selectedDay = try await $activityDay.requestDisambiguation(
among: daysAsEntities,
dialog:"Which day would you like to plan an activity for?"
)
}
}
Hier sind einige Bilder, die helfen könnten. src = "https://i.sstatic.net/tp3zfacj.png"/>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post