Update UIApplicationShortcutItem from extension

228 views Asked by At

I am building a Today Extension to an app, and it works great to modify my application data. But now my dynamic UIApplicationShortcutItems are out of sync.

I can't access UIApplication.shared from my extension. Is there a way to ask the app to update UIApplication.shared.shortcutItems without bringing it to the foreground?

1

There are 1 answers

0
Paul King On

I have found that MMWormhole is a good solution to this problem. It acts somewhat like an NSNotificationCenter notification between the app extension and its host application. This lets you notify the app to update its shortcut items whenever the today widget takes some action that makes the shortcuts get out of sync. The only downside is that the host application must be actively running in the background for the notification to trigger its intended action.