ios canOpenUrl - 此应用不允许查询方案 instragram
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32870393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
canOpenUrl - This app is not allowed to query for scheme instragram
提问by DevC
Im trying to add the Instagram url to my app in iOS9 however I am getting the following warning:
我试图在 iOS9 中将 Instagram 网址添加到我的应用程序中,但是我收到以下警告:
-canOpenURL: failed for URL: "instragram://media?id=MEDIA_ID" - error: "This app is not allowed to query for scheme instragram"
However, Ive added the following to the LSApplicationQueriesSchemes
in my info.plist
;
但是,我已将以下内容添加到LSApplicationQueriesSchemes
我的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?
任何帮助是极大的赞赏?
EDIT 1
编辑 1
This is the code I am using to open instagram:
这是我用来打开 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");
}
based off this example.
基于这个例子。
回答by rmaddy
Your
LSApplicationQueriesSchemes
entry should only have schemes. There's no point to the second entry.<key>LSApplicationQueriesSchemes</key> <array> <string>instagram</string> </array>
Read the error. You are trying to open the URL with a typo in the scheme. Fix your reference to
instragram
in your call tocanOpenURL:
.
您的
LSApplicationQueriesSchemes
条目应该只有方案。第二个条目没有意义。<key>LSApplicationQueriesSchemes</key> <array> <string>instagram</string> </array>
阅读错误。您正在尝试打开方案中有拼写错误的 URL。修复您
instragram
在调用中对 的引用canOpenURL:
。
回答by Andr3a88
Put only <string>instagram</string>
. It's not necessary the full path but the base of the scheme url.
只放<string>instagram</string>
。不需要完整路径,而是方案 url 的基础。
回答by Ofir Malachi
For Facebook who's need:
对于需要的 Facebook:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbshareextension</string>
</array>