DESCRIPTION OF PROBLEM
We discovered that Siri can directly launch Amap and Tencent Maps for navigation. Our app also wants to integrate this feature. After our research, we found that AppIntents cannot accomplish this functionality. Because the parameters of AppIntents are limited.
How can we achieve this? Do we need to apply for certain permissions from Apple?
STEPS TO REPRODUCE
awake siri
say "使用高德地图打车去南京南站"
Post
Replies
Boosts
Views
Activity
How to use AppIntents to parse user's speech and support direct parameter parsing?
when i use AppEntity like this:
@Parameter(title: LocalizedStringResource(stringLiteral: "SIRI_END"), requestValueDialog: "where you go")
var end: MapPoiAppEntity
in MapPoiAppEntity
Siri must first ask a question, and the user must answer before this method can be executed:
func entities(matching string: String) async throws -> [MapPoiAppEntity]
For example, if the user wakes up Siri and directly says, "I want to take a taxi to San Francisco," this method will not be executed, and the parameters will not be parsed.
I later discovered that I must first feed the data to this method in order to parse it.
func suggestedEntities() async throws -> [MapPoiAppEntity] {
print("identifier-> suggestedEntities")
let items = Self.saveItems
return items
}
This way, the destination can only be a limited list, and it cannot be used extensively. Why can't you just give me the destination directly in the "func entities(matching string: String)" method?
This is a knowledge point that I have not yet understood. If that's the case, please provide guidance. Or is it a design limitation from Apple that the dynamic parameter parsing can only have a limited list? Please tell me.
Thread 30 Crashed:
0 Network nw_protocol_ipv4_disconnected(nw_protocol*, nw_protocol*) (in Network) + 96
1 Network nw_channel_disconnect_flow(nw_channel*, nw_channel_input_flow*) (in Network) + 204
2 Network nw_channel_disconnect_flow(nw_channel*, nw_channel_input_flow*) (in Network) + 204
3 Network invocation function for block in nw_channel_handle_defunct(nw_channel*) (in Network) + 40
4 Network nw_hash_table_apply (in Network) + 2696
5 Network nw_channel_handle_defunct(nw_channel*) (in Network) + 644
6 Network nw_channel_check_defunct(nw_channel*) (in Network) + 92
7 Network nw_channel_update_input_source(nw_channel*, nw_protocol*, bool) (in Network) + 8892
8 Network invocation function for block in nw_channel_create(nw_context*, unsigned char*, unsigned int, void*, unsigned int, bool, bool, bool*) (in Network) + 72
9 libdispatch.dylib _dispatch_client_callout (in libdispatch.dylib) + 20
10 libdispatch.dylib _dispatch_continuation_pop (in libdispatch.dylib) + 600
11 libdispatch.dylib _dispatch_source_latch_and_call (in libdispatch.dylib) + 420
12 libdispatch.dylib _dispatch_source_invoke (in libdispatch.dylib) + 832
13 libdispatch.dylib _dispatch_workloop_invoke (in libdispatch.dylib) + 1756
14 libdispatch.dylib _dispatch_root_queue_drain_deferred_wlh (in libdispatch.dylib) + 288
15 libdispatch.dylib _dispatch_workloop_worker_thread (in libdispatch.dylib) + 404
16 libsystem_pthread.dylib _pthread_wqthread (in libsystem_pthread.dylib) + 288