Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Siri and Voice

RSS for tag

Help users quickly accomplish tasks related to your app using just their voice.

Posts under Siri and Voice tag

74 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Siri Intent Dismiss callback issue
I am opening the Siri shortcut screen from the viewDidLoad method, as follows: override func viewDidLoad() { super.viewDidLoad() // Present the Siri Shortcut screen to add Card Payment Intent let viewController = INUIAddVoiceShortcutViewController(shortcut: INShortcut(intent: self.cardPaymentIntent)!) viewController.modalPresentationStyle = .pageSheet // Setting Delegate viewController.delegate = self self.present(viewController, animated: true, completion: nil) } // Delegate Method Conformance :: INUIAddVoiceShortcutViewControllerDelegate @available(iOS 12.0, *) func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) { controller.dismiss(animated: true, completion: nil) // The issue is here. Whether we add the or Dismiss the Siri shortcut screen without adding it, this delegate gets called. } @available(iOS 12.0, *) func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) { controller.dismiss(animated: true, completion: nil) } // Card Payment Intent public var cardPaymentIntent: CardPaymentIntent { let intent = CardPaymentIntent() intent.suggestedInvocationPhrase = NSLocalizedString("Pay my credit card", comment: "") return intent } Whenever I present the siri shortcut screen, either I add the shortcut or dismiss the screen without adding. In both cases , the shortcut is added. And this method is called every time func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) Any solution ? while I dismiss the screen, i want it not to be added into the shortcut
1
0
659
Sep ’24
Siri can directly launch Map App for navigation
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 "使用高德地图打车去南京南站"
4
0
637
Jul ’24
muting SIRI via AppIntents
We're using App Intents to launch are control our app via Siri. Siri's responses have been fairly random, some with a "Done" popup, others with a verbal confirmation, others saying "I'm sorry, there's been a problem". The latter is bogus and doesn't look good to potential investors when the app is actually working fine. There appears to be no way in code that I've been able to find so far that would have been tell Siri to STFU. Let us handle our own errors. Otherwise is there a means to supply Siri with a dictionary of restored messages that could be triggered inside the app?
1
0
781
Jul ’24
Siri not calling AppIntents
I am very new to App Intents and I am trying to add them to my On Device LLM ChatBot app so my users can get answers to any questions anywhere in iOS. I have the following code and it is working wonderfully in the Shortcuts app. import AppIntents struct AskAi: AppIntent { static var openAppWhenRun: Bool = false static let title: LocalizedStringResource = "Ask Ai About" static let description = "Gets an answer from Ai for your question." @Parameter(title: "Question") var question: String static var parameterSummary: some ParameterSummary { Summary("Ask Ai About \(\.$question)") } @MainActor func perform() async throws -> some IntentResult & ReturnsValue<String> { let bot: Bot = Bot() await bot.respond(to: self.question) return .result( value: bot.output ) } } class AppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: AskAi(), phrases: [ "Ask \(.applicationName) \(\.$question)", "Get \(.applicationName) answer for \(\.$question)", "Open \(\.$question) using \(.applicationName) ", "Using \(.applicationName) get help with \(\.$question)" ], shortTitle: "Ask Ai", systemImageName: "sparkles" ) } } I can create a shortcut for this AppIntent and that allows me say speak the response. I can call my shortcut via iOS 18 Beta 1 by the Shortcut name I set in the Shortcuts app and that allows it to work. It does not work at all by just Asking Siri any of the phrases I have defined. The info.plist has an app name alias defined just to be sure. I even added the Siri capability in Xcode-beta. I also tried using the ProvidesDialog return type too. Whatever I do the AppIntent is invisible to Siri. Siri tries to search the web, looking for my app name in the contacts or have an error Apple Cash which has nothing to do with what I was talking about. Is there anything else I am missing for setting up iOS AppIntents to work with Siri?
3
1
1.4k
Jul ’24
Can't get audio data from INSendMessageIntent
guard let fileURL = intent.attachments?.first?.audioMessageFile?.fileURL else { print("Couldn't get fileNameWithExtension from intent.attachments?.first?.audioMessageFile?.fileURL?.lastPathComponent") return failureResponse } defer { fileURL.stopAccessingSecurityScopedResource() } let fileURLAccess = fileURL.startAccessingSecurityScopedResource() print("FileURL: \(fileURLAccess)") let tempDirectory = FileManager.default.temporaryDirectory let tempFileURL = tempDirectory.appendingPathComponent(UUID().uuidString + "_" + fileURL.lastPathComponent) do { // Check if the file exists at the provided URL guard FileManager.default.fileExists(atPath: fileURL.path) else { print("Audio file does not exist at \(fileURL)") return failureResponse } fileURL.stopAccessingSecurityScopedResource() // Check if the temporary file already exists and remove it if necessary if FileManager.default.fileExists(atPath: tempFileURL.path) { try FileManager.default.removeItem(at: tempFileURL) print("Removed existing temporary file at \(tempFileURL)") } // Copy the audio file to the temporary directory try FileManager.default.copyItem(at: fileURL, to: tempFileURL) print("Successfully copied audio file from \(fileURL) to \(tempFileURL)") // Update your response based on the successful upload // ... } catch { // Handle any errors that occur during file operations print("Error handling audio file: \(error.localizedDescription)") return failureResponse } guard let audioData = try? Data(contentsOf: tempFileURL), !audioData.isEmpty else { print("Couldn't get audioData from intent.attachments?.first?.audioMessageFile?.data") return failureResponse } Error: FileURL: false Audio file does not exist at file:///var/mobile/tmp/SiriMessages/BD57CB69-1E75-4429-8991-095CB90959A9.caf is something I'm missing?
2
1
746
Oct ’24
Include Parameters in AppIntent invocation?
I'd like to build an AppIntent where the parameters are included in the initial invocation. First-party example "Set a timer for 10 minutes" immediately sets new timer using the parameter 10 minutes. Is this possible via AppIntents? Or do we have to invoke with "Set a timer" then give parameters via dialog: "for how long"? with user replying "10 minutes."
1
2
1.2k
Sep ’24
¿How do I make Siri announce the local currency on notifications?
I'm currently testing the announce notifications feature and I can't seem to find out how to make Siri read aloud the current currency instead of dollars. My locale is es-CL (Chile). It uses the currency symbol $ and reads as Pesos locally or Chilean Pesos where the number 5000.1 is represented as 5.000,1 This is the notification content         let content = UNMutableNotificationContent()         content.body = "¡Has recibido un pago por $5.000!" Siri reads it aloud as "¡Has recibido un pago por 5.000 Dolares!" which translates to "You have received a payment for 5,000 Dollars", instead of the expected "¡Has recibido un pago por 5.000 Pesos!" -> "You have received a payment for 5,000 Pesos" I've tried changing the development region of the app, interpolating the string with NumberFormatter.localizedString(from: 5000, number: .currency), and with others styles( .currencyAccounting, .currencyISOCode and .currencyPlural) without good results. The last one seems to work buts it's not ideal since it outputs "5.000 pesos chilenos" which gets read as "5 pesos chilenos" which is not the correct amount (bug), it's as is you're not on Chile and I personally prefer it to be a symbol instead of words. I'm testing with my device which is setup with the region "Chile" Could someone help me find a solution?
5
1
1.2k
Feb ’25
SiriTipUIView is missing the application name for an app shortcut
I'm working on an app for an accompanying toy that allows you do drop a marble on a self made track. As a nice bonus I wanted to make it possible to drop a marble using Siri Shortcuts, Siri or the HomePod. So the new iOS 16 App Intents work great for this. The App Intent documentation is bare, but I got the App Intent to work and it evens shows a custom error message when something goes wrong, However I now want to promote the feature. SiriTipUIView is meant for this, however I'm seeing an issue. The application name is missing from the tips UI, instead the phrase starts with a space. The code for the App Shortcuts struct MyAppShortcutsProvider: AppShortcutsProvider {     static var appShortcuts = [         AppShortcut(intent: DropMarbleIntent(), phrases: [             "\(.applicationName) drop marble",             "\(.applicationName) drop a marble",             "Drop a \(.applicationName)",             "Drop \(.applicationName)"         ])     ] } The code for the SiriTipUIView (just for testing) let tipView = SiriTipUIView() tipView.setIntent(intent: DropMarbleIntent()) tipView.sizeToFitUsingConstraints() tipView.allowsDismissal = true presentedSubscription = tipView.publisher(for: \.isPresented).sink { isPresented in if isPresented == false {     self.tableView.tableHeaderView = nil     } } tableView.tableHeaderView = tipView This happens on any iOS 16 simulator and on an iPhone 13 Pro running the iOS 16 release version. Am I missing something, or should I report a bug using feedback?
4
1
1.8k
Sep ’24