canOpenURL: failed for URL: “instagram://app” - error: “This app is not allowed to query for scheme instagram”

后端 未结 4 805
失恋的感觉
失恋的感觉 2021-01-01 12:12

This is the code I use:

let instagramURL = NSURL(string: \"instagram://app\")
if UIApplication.shared.canOpenURL(instagramURL! as URL) {
  //Code
} else {
           


        
4条回答
  •  再見小時候
    2021-01-01 12:38

    For those who try to open the app using custom URL Scheme (assume that app FirstApp opens SecondApp):

    • In FirstApp add LSApplicationQueriesSchemes with URL Scheme to Info.plist like this:

    • In SecondApp register new URL Scheme in URL Types like this:

提交回复
热议问题