canOpenURL:网址失败:"instagram://app"; -错误:“此应用程序不允许查询方案instagram" [英] canOpenURL: failed for URL: "instagram://app" - error: "This app is not allowed to query for scheme instagram"

查看:76
本文介绍了canOpenURL:网址失败:"instagram://app"; -错误:“此应用程序不允许查询方案instagram"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我使用的代码:

let instagramURL = NSURL(string: "instagram://app")
if UIApplication.shared.canOpenURL(instagramURL! as URL) {
  //Code
} else {
  //Showing message "Please install the Instagram application"
}

我无法进入if循环.

我收到此错误:

canOpenURL:URL:"instagram://app"失败-错误:此应用不允许查询instagram"

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

我也在我的设备上使用Instagram登录.

I have also Login with Instagram in my device.

推荐答案

右键单击您的 plist文件,然后将其作为源代码打开.然后复制并粘贴以下代码:

Right click on your plist file and open it as source code. Then copy and paste below code:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>instagram</string>
</array>

注意:必须记住的一件事是它在模拟器上不起作用.为此,您需要一个真正的设备.

Note: One thing you have to keep in mind that it will not work on simulator. You need a real device for this.

这篇关于canOpenURL:网址失败:"instagram://app"; -错误:“此应用程序不允许查询方案instagram"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆