INVoiceShortcutCenter's getAllVoiceShortcutsWithCompletion always returns no shortcuts

Running four different apps which use Siri shortcuts, my app claims there are no existing voice shortcuts created. INVoiceShortcutCenter's getAllVoiceShortcutsWithCompletion completes without an error, but the callback is always passed an empty array of INVoiceShortcuts.


If I try and add a new shortcut using my suggested phrase I receive an alert "Name Cannot Be Used" with the message "You already have a shortcut named '...'. Please choose another name for this shortcut".


If I choose another phrase and add a voice shortcut for that it is added, but getAllVoiceShortcutsWithCompletion still returns no shortcuts. Both the existing (created on iOS 12) and the newly-added voice shortcut appear in the Apple Shortcuts app and seem to function correctly.


A Stack Overflow question created on July 4th 2019 reports the same issue: https://stackoverflow.com/questions/56884855/invoiceshortcutcenter-shared-getallvoiceshortcuts-does-not-return-anything-in-io


The Xcode 11 build run on iOS 12 works as expected.


The App Store version (built with Xcode 10) run on iOS 13 beta 4 seems to fail the availability check in the code for iOS 12 so doesn't even show me the UI to access the Siri shortcuts section of my app! That's a whole separate issue...

Accepted Reply

Ok, fixed for me in beta 7.

Replies

I downloaded the current App Store version of another of my apps that uses Siri Shortcuts. That was built with Xcode 10.x and also reports no voice shortcuts when run on iOS 13 beta 4, and won't let me create a new one (because a voice shortcut with that phrase already exists).

This has been broken since iOS 13 beta 4. getAllVoiceShortcuts method is returning "Failed to create an INVoiceShortcut from VCVoiceShortcut…" error.


I have submitted a bug report FB6716898 two weeks ago but as you can guess that has been no progress on it.

Ah yes, I see the same error message. In fact, I get a pair of errors for each voice shortcut:



2019-07-30 11:25:22.825858+0100 BinDayAlert[515:41239] [Intents] -[INVoiceShortcut _initWithVCVoiceShortcut:] Unexpectedly got nil INShortcut for voice shortcut <VCVoiceShortcut 0x2811149c0

identifier: 8EE7785F-C593-467B-9113-9E4DB5543DAE

phrase: When is the next recycling collection

shortcutName: When is the next recycling collection

shortcutDescription: View Recycling Next Collection Date

associatedAppBundleIdentifier: com.hacknicity.bindayalert

dateCreated: 2019-01-29 14:14:40 +0000

dateLastModified: 2019-07-30 09:36:04 +0000>


2019-07-30 11:25:22.826270+0100 BinDayAlert[515:41239] [Intents] -[INVoiceShortcutCenter getAllVoiceShortcutsWithCompletion:]_block_invoke Failed to create an INVoiceShortcut from VCVoiceShortcut=<VCVoiceShortcut 0x2811149c0

identifier: 8EE7785F-C593-467B-9113-9E4DB5543DAE

phrase: When is the next recycling collection

shortcutName: When is the next recycling collection

shortcutDescription: View Recycling Next Collection Date

associatedAppBundleIdentifier: com.hacknicity.bindayalert

dateCreated: 2019-01-29 14:14:40 +0000

dateLastModified: 2019-07-30 09:36:04 +0000>



It's still broke in beta 5.

My reply only specific to this point:

The App Store version (built with Xcode 10) run on iOS 13 beta 4 seems to fail the availability check in the code for iOS 12 so doesn't even show me the UI to access the Siri shortcuts section of my app! That's a whole separate issue...


- This was also in one of our app, but found solution for it. Hope our case will help you. Our app live on app store from more than 5 years and developed in objective c, siri shortcuts with intent class generated files of objective c. If you change code generation for siri shortcuts to swift, the problem will be resolved automatically.

- Go to main project build settings (not target project settings)

- search for "Intent Class generation Language", and change it from objective c to swift.


I am 100% sure you will not believe this solution, but it works like magic. You might required to make more changes as siri shortcut intent classes will be generated in swift and you have to import swift header file wherever you are using siri shortcut intent class files.

> The App Store version (built with Xcode 10) run on iOS 13 beta 4 seems to fail the availability check in the code for iOS 12 so doesn't even show me the UI to access the Siri shortcuts section of my app! That's a whole separate issue...


I don't think I explained my issue very well. What I meant is that my settings screen hides options/features that don't apply for the iOS version that the app is running on. In this case, I have an row in my settings screen to go to a sub-screen where the user can manage their Siri Shortcuts and add/delete voice phrases. I found that downloading the App Store version of my app (built with Xcode 10.x) onto a device running iOS 13 beta 4 was hiding that row. The only way that can happen is if an "if (@available(iOS 12.0, *))" test fails. I do use only Objective-C in this app, but the code that hides the settings row knows nothing about the fact that it leads to a Siri feature. It just thinks it is NOT on iOS 12 (or later), so hid the row.


I tried again just now (downloading the App Store version) onto iOS 13 beta *5* and the row is visible. So I either was wrong before when I claimed I couldn't see the row on beta 4, or the availability check that was broken in beta 4 now works in beta 5. Another of my apps (with almost identical code), didn't hide the option on beta 4, so it's looking more and more likely that I was just having a bad day and mis-reported that problem! But that is a side issue and not important. The real problem is that my apps cannot see the voice shortcuts they have made.

Hi, I understand your issues clearly.


The problem was in earlier beta, the check was failing for determining ios 12, but i have got one workaround is when change "Intent Class generation Language" to swift, the same check @available(ios 12, *) in objective c started working in beta 4 or earlier too.


Beta 5 might fixed that issue, so not required to make any changes now. This caused many beta users who are using complications, and it stopped because of that @available() check. It was failing for watch app too. So we fixed with changing to swift and released version on app store.


And yes, still no workaround for

INVoiceShortcutCenter's getAllVoiceShortcutsWithCompletion always returns no shortcuts

Still seeing this issue with beta 6.

How did you get your Objective-C intent handling files to read the Swift auto-generated code? It didn't generate a bridging header as far as I can tell.

Finally figured out that I needed to add a Swift file to the target to get Xcode to create both bridging headers.

Ok, fixed for me in beta 7.

Fixed for me in iOS 11 dev beta 7 as well!!!

Works for me too in beta 7.