INVoiceShortcutCenter.shared.getAllVoiceShortcuts not finding NSUserActivity shortcuts

In iOS 13 beta 6, the INVoiceShortcutCenter.shared.getAllVoiceShortcuts() method is not returning existing shortcuts. The same code worked fine in iOS 12.


Below is the code that I used to create the NSUserActivity for the shortcut:

func createUserActivityForShortcut(workoutName: String, timerID: String) -> NSUserActivity? { 

    let userActivity = NSUserActivity(activityType: "com.mycompany.myapp.start-timer") 
    userActivity.isEligibleForSearch = true 

    userActivity.isEligibleForPrediction = true 
    userActivity.suggestedInvocationPhrase = "Start \(workoutName)" 

    userActivity.title = "Start \(workoutName)" 
    userActivity.userInfo = ["timerID": timerID] 
    userActivity.persistentIdentifier = timerID 
    userActivity.needsSave = true 
    userActivity.requiredUserInfoKeys = ["timerID"] 
    userActivity.becomeCurrent() 

    return userActivity 

}


Steps to Reproduce:

1) Create NSUserActivity using the above method

2) Add a voice shortcut using INUIAddVoiceShortcutViewController

3) Retrieve list of voice shortcuts using INVoiceShortcutCenter.shared.getAllVoiceShortcuts and the list is empty


I've reported the issue, but is anyone else having the same problem?

Yes, I see that problem too. See https://forums.developer.apple.com/thread/120489

INVoiceShortcutCenter.shared.getAllVoiceShortcuts not finding NSUserActivity shortcuts
 
 
Q