I am adding all my 3D Touch actions in my app delegate but how can I update the subtitle of one of the actions throughout my app?
Take a look at this reference from Apple. The first code sample gives you what you need to modify an existing quick action with a new localizedTitle
.
Here's the Objective-C code from the Apple example. In summary, you create a UIMutableApplicationShortcutItem
with a mutable copy of the shortcut item you want to modify. Change the title and then replace the previous shortcut with the new one.
NSArray <UIApplicationShortcutItem *> *existingShortcutItems = [[UIApplication sharedApplication] shortcutItems];
UIApplicationShortcutItem *anExistingShortcutItem = [existingShortcutItems objectAtIndex: anIndex];
NSMutableArray <UIApplicationShortcutItem *> *updatedShortcutItems = [existingShortcutItems mutableCopy];
UIMutableApplicationShortcutItem *aMutableShortcutItem = [anExistingShortcutItem mutableCopy];
[aMutableShortcutItem setLocalizedTitle: @“New Title”];
[updatedShortcutItems replaceObjectAtIndex: anIndex withObject: aMutableShortcutItem];
[[UIApplication sharedApplication] setShortcutItems: updatedShortcutItems];