I have just added a today widget to my app and I am trying to allow users to tap on the widget to launch it's containing app.
Basically at the moment I have a button over the top of my widget which is linked to this function:
@IBAction func launchApp(sender: AnyObject) {
var url: NSURL = NSURL.URLWithString("AppName://home")
self.extensionContext.openURL(url, completionHandler: nil)
}
When I run the app and tap on the widget I get an alert view that states:
Unsupported URL - This URL wasn't loaded: AppName://home
Where am I going wrong?
To launch an app via URL you have to add a URL scheme to your app. The details of how to do that are found here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With