115

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"

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?

EDIT 1

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");
}

based off this example.

2
  • 6
    Is it because you've written instragram instead of instagram?
    – James P
    Sep 30, 2015 at 15:50
  • 2
    @JamesP slaps himself in the face how did i miss that, but ive fixed it and the issue still remains.
    – DevC
    Sep 30, 2015 at 15:53

3 Answers 3

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

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>instagram</string>
    </array>
    
  2. 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:.

2
  • 1
    Thats embarrassing, i read the error message about 30 times and kept over looking it. The error is now gone. The first point is also correct, there was no need for the second entry.
    – DevC
    Sep 30, 2015 at 15:58
  • 17
    It's like trying to proof read your own paper. It doesn't work. You keep seeing what you expect it to be, not what it really is.
    – rmaddy
    Sep 30, 2015 at 15:59
10

For Facebook who's need:

<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>
3
  • 6
    This has nothing to do with the question.
    – rmaddy
    Jun 23, 2018 at 16:10
  • this does not answer the real question Dec 4, 2019 at 6:20
  • 5
    facebook owns instgram.. cough
    – Ezos
    Jun 3, 2020 at 21:02
7

Put only <string>instagram</string>. It's not necessary the full path but the base of the scheme url.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.