草庐IT

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

coder 2023-07-15 原文

这是我使用的代码:

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

我无法进入 if 循环。

我收到这个错误:

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

我还在我的设备中使用 Instagram 登录。

最佳答案

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

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

注意:您必须牢记一件事,它不能在模拟器上运行。为此,您需要一个真实的设备。

关于ios - canOpenURL : failed for URL: "instagram://app" - error: "This app is not allowed to query for scheme instagram",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43975915/

有关ios - canOpenURL : failed for URL: "instagram://app" - error: "This app is not allowed to query for scheme instagram"的更多相关文章

随机推荐