Dear Apple Developers,
I have an issue about Siri shortcut that cannot run in iOS 16. When I call the shortcut, Siri only responds "OK" or "Done" but do nothing. But if I check in the "shortcut" and run my shortcut, it will run properly.
I'm so confuse about that, because it only happen in iOS 16, under iOS 16 can be used normally.
This is my code:
- Present siri shortcut
fileprivate func presentAddSiriShortcutViewController(_ activity: NSUserActivity) {
if #available(iOS 12.0, *) {
let shortcut = INShortcut(userActivity: activity)
let viewController = INUIAddVoiceShortcutViewController(shortcut: shortcut)
viewController.delegate = self
present(viewController, animated: true)
}
}
- Activity
+ (NSUserActivity *)openPhotoActivity {
if (@available(iOS 12.0, *)) {
NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType:@"openPhoto"];
userActivity.eligibleForSearch = YES;
userActivity.eligibleForPrediction = YES;
userActivity.title = MyLocalizedString(@"title_open_photo");
userActivity.suggestedInvocationPhrase = MyLocalizedString(@"keyword_open_photo");
return userActivity;
} else {
return nil;
}
}
This code can be run normally in under iOS 16. Does the use of "NSUserActivity" no longer apply to iOS 16?
Should I use Intent using SiriKit?