All of my apps are currently written in Obj-C. The link https://developer.apple.com/library/content/samplecode/ApplicationShortcuts/Introduction/Intro.html#//apple_ref/doc/uid/
If you look at the sample code provided for apple, you'll see that they suggest that you write a method that handles your shortcut item so that you can handle it in all three places:
application: performActionForShortcutItem
,application: didFinishLaunchingWithOptions
andwillFinishLaunchingWithOptions
An example of what I did was:
- (BOOL)handleShortCutItem:(UIApplicationShortcutItem *)shortcutItem {
BOOL handled = NO;
if (shortcutItem == nil) {
return handled;
}
if ([shortcutItem.type isEqualToString:kFavoritesQuickAction]) {
handled = YES;
}
if (handled) {
// do action here
}
return handled;
}
Then you would just call this method in any place where you are getting a shortcut item. This should help you along your way!