简体   繁体   中英

Swift Error when trying to open other apps from my app | The operation couldn’t be completed. (OSStatus error -10814.)

I am trying to let my app open the HBO Go app and automatically play a listed movie or tv show. For example, hbonow://asset?id=PROD773137 is returned as the variable link in the following example:

if let link = allSources[indexPath.row]["link"] as? String {
            let url  = NSURL(string: link)
            if UIApplication.shared.canOpenURL(url! as URL) {
                UIApplication.shared.open(url as! URL, options: [:], completionHandler: nil)
            } 
        }

I've already added hbogo to LSApplicationQueriesSchemes in my info.plist, but I get the following error when I try to open HBO Go via my app:

-canOpenURL: failed for URL: "hbonow://asset?id=PROD773137" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

I can't seem to find any information on the error message. Does anyone have any experience with this error or recognize what I could be missing?

It's because the HBO NOW app wasn't installed on the device I was using.

I expected the App Store to open up and direct users to the app they needed to download, but that's not how the canOpenURL works when it encounters this error.

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