Open app from iOS widget using Swift

How can I open my application from the Today widget using Swift? I just want to click Widget, and I would like to open my application. I got a button right now in my opinion, the button is clear. But this does not work for me :( I need help :)

@IBAction func launchApp(sender: AnyObject) { var url: NSURL = NSURL.URLWithString("AffordItLauncher://") self.extensionContext?.openURL(url, completionHandler: nil) } 
+6
source share
1 answer

In your info.plist you need to add the following:

enter image description here

And make sure your application name matches the name of your url. In your case, it should be AffordItLauncher

+10
source

Source: https://habr.com/ru/post/983548/


All Articles