I'm working on an app right now, and I'm trying to create a button that opens an app that the user has downloaded. Thanks to previous questions, I got SOME working code (Swift). I have the following.
@IBAction func Website(_ sender: Any) {
let powerHooks = "mspbi://app/"
let powerUrl = NSURL(string: powerHooks)
if UIApplication.shared.canOpenURL(powerUrl! as URL)
{
UIApplication.shared.openURL(powerUrl! as URL)
} else {
//redirect to safari because the user doesn't have Power BI
UIApplication.shared.openURL(NSURL(string: "http://powerbi.microsoft.com")! as URL)
}
}
Basically, I have a button that, when clicked, is supposed to open the Microsoft Power BI app I have on my iPad. Unfortunately, I keep getting the error "This app is not allowed to query for scheme mspbi? The URI I have is straight from Microsoft's website. Thoughts on how to open the app? It always skips the "if" and goes right to "else"