简体   繁体   中英

Open App From Widget IOS with Swift

How I can open my App from the Today Widget with Swift ? I just want to pressed the Widget and than i would like to open my App. I got right now a button on my whole view the button is clear. But that don't work for me:( I need Help:)

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

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

在此输入图像描述

And make sure that your app name is the same as the one in your url. In your case, it should be AffordItLauncher

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM