Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open App From Widget IOS with Swift

Tags:

ios

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)
}
like image 728
BilalReffas Avatar asked Mar 09 '15 19:03

BilalReffas


1 Answers

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

enter image description here

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

like image 60
Ashraf Tawfeeq Avatar answered Nov 15 '22 20:11

Ashraf Tawfeeq