'iOS Quick Actions to be run if app not in the background?
I'm trying to make a quick action perform something on my iOS app. It is working if my app is on the background, but if I launch it directly through the quick action, nothing happens. This is what I got in my SceneDelegate :
func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
switch shortcutItem.type {
case "test":
//DOSOMETHING
break
default:
break
}
I tried to make this work through the application:didFinishLaunchingWithOptions method in AppDelegate, but this is not working. I tried :
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if let shotcutItem = launchOptions?[UIApplication.LaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem{
switch shortcutItem.type {
case "test":
// DO SOMETHING
break
default:
break
}
return true
}
What am I missing ?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
