canOpenUrl-不允许该应用查询方案图 [英] canOpenUrl - This app is not allowed to query for scheme instragram

查看:113
本文介绍了canOpenUrl-不允许该应用查询方案图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Instagram网址添加到iOS9中的我的应用中,但是我收到以下警告:

Im trying to add the Instagram url to my app in iOS9 however I am getting the following warning:

-canOpenURL: failed for URL: "instragram://media?id=MEDIA_ID" - error: "This app is not allowed to query for scheme instragram"

但是,我已经在我的info.plist中的LSApplicationQueriesSchemes中添加了以下内容;

However, Ive added the following to the LSApplicationQueriesSchemes in my info.plist;

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>instagram</string>
    <string>instagram://media?id=MEDIA_ID</string>//this one seems to be the issue
</array>

任何帮助都将不胜感激吗?

Any help is greatly appreciated?

编辑1

这是我用来打开instagram的代码:

This is the code I am using to open instagram:

 NSURL * instagramURL = [NSURL URLWithString:@"instragram://media?id=MEDIA_ID"];//edit: note, to anyone copy pasting this code, please notice the typo OP has in the url, that being "instragram" instead of "instagram". This typo was discovered after this StackOverflow question was posted.
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    //do stuff
}
else{
    NSLog(@"NO instgram found");
}

基于此示例.

推荐答案

  1. 您的LSApplicationQueriesSchemes条目应仅具有方案.没有必要指向第二个条目.

  1. Your LSApplicationQueriesSchemes entry should only have schemes. There's no point to the second entry.

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

  • 读取错误.您正在尝试在方案中输入错误的URL.在对canOpenURL:的调用中将对instragram的引用固定.

  • Read the error. You are trying to open the URL with a typo in the scheme. Fix your reference to instragram in your call to canOpenURL:.

    这篇关于canOpenUrl-不允许该应用查询方案图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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