Siri快捷指令无法识别葡萄牙语人名(模拟器正常)
问题:App Shortcuts无法识别葡萄牙语人名(仅模拟器正常运行)
- 巴西地区环境下,常规Siri可正常识别葡萄牙语人名,但在App Shortcuts中无法识别该类人名
- 仅模拟器中可正常运行,已在运行iOS 17.2的iPhone 13 Pro真机上完成测试
相关代码(Swift)
struct Intents { @available(iOS 16, *) struct ShortcutsProvider: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: ContactsIntent(), phrases: [ "Contato com \(.applicationName)" ], shortTitle: LocalizedStringResource("Falar") ) } } } @available(iOS 16, *) struct ContactsIntent: AppIntent { static var title: LocalizedStringResource = "Select contact" static var openAppWhenRun = true static var authenticationPolicy: IntentAuthenticationPolicy = .requiresAuthentication @Parameter( title: "Contacts", description: "Send to contacts", requestValueDialog: IntentDialog("Who is the contact?"), optionsProvider: ContactsectionsOptionsProvider() ) var contact: String private struct ContactsectionsOptionsProvider: DynamicOptionsProvider { func results() async throws -> ItemCollection<String> { return ItemCollection { ItemSection( items: DataStorage.contacts.map { let name = $0.capitalized(with: .autoupdatingCurrent) return IntentItem<String>.init( name, title: LocalizedStringResource(stringLiteral: name) ) } ) } } } @MainActor func perform() async throws -> some IntentResult { // This never is called return .result() } } struct DataStorage { // Communs names in Brazil static var contacts: [String] { [ "Adriano", "Ricardo", "Bruno" ] } }
内容的提问来源于stack exchange,提问作者MaatheusGois
相关产品推荐
相关产品推荐

