INUIAddVoiceShortcutButton have many bugs in iOS 12.0 Release

https://stackoverflow.com/questions/52342934/siri-shortcut-button-inuiaddvoiceshortcutbutton-shows-wrong-title-when-have-mu

So simple INUIAddVoiceShortcutButton have unbelivable amout of bugs for major feature release.


1) INUIAddVoiceShortcutButton did not support INShortcut created from NSUserActivity. Button will always show first created INVoiceShortcut for every instance of INUIAddVoiceShortcutButton even if it have different INShortcut assigned to them. So you can't create more then 1 shortcut for your app usign NSUserActivity.

https://stackoverflow.com/questions/52342934/siri-shortcut-button-inuiaddvoiceshortcutbutton-shows-wrong-title-when-have-mu


2) INUIAddVoiceShortcutButton did not support INShortcut created from INIntent too! Use INUIAddVoiceShortcutButton to create INVoiceShortcut with for example INPlayMediaIntentand and next recreate INUIAddVoiceShortcutButton. INUIAddVoiceShortcutButton will not find your previously created INVoiceShortcut even if you create it with exactly the same INShortcut. The only way to fix it is to enumerate INVoiceShortcutCenter.getAllVoiceShortcutsWithCompletion and find match INVoiceShortcut instance and use it INVoiceShortcut.shortcut to initiate INUIAddVoiceShortcutButton. In this case Button will catch it.

I suppose internally INUIAddVoiceShortcutButton use == pointer comparation in ObjC code (Swift generation 🙂 ).



3) INUIAddVoiceShortcutButton did not update its state when you remove INVoiceShortcut from iOS Settings -> Siri Shortcuts.


Radar:44754428

Replies

Also NSUserActivity did not store persistentIdentifier.

So call NSUserActivity.deleteSavedUserActivitiesWithPersistentIdentifiers() did nothing

Hi, Thanks for documenting this. I'm having the same issue. I can't find a workable solution for using a INUIAddVoiceShortcutButton with NSUserActivities when there are multiple instances with the same activity type. Have you found any?

Hello,

The only solution it to use swizzle and make correct implementation for INUIAddVoiceShortcutButton @selector(setVoiceShortcut:). It must check that incoming INVoiceShortcut is correct. If not call INVoiceShortcutCenter.getAllVoiceShortcutsWithCompletion in results find correct voice shortcut instance and pass it to original setVoiceShortcut: in main thread.

Or you can make your own Button.

Thanks. Not sure I want to go there 🙂. I think I'll just use an alternative interface. Is your radar still open or was it marked as a duplicate?

As of now no reply from Apple or status change.

Hello,

Any updates on the issue?

I did not get any response from Apple in bug report.

As I know this is not fixed in iOS SDK 12.1