web-dev-qa-db-fra.com

canOpenUrl - Cette application n'est pas autorisée à rechercher le schéma instagram

J'essaie d'ajouter l'URL Instagram à mon application dans iOS9, mais l'avertissement suivant s'affiche:

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

Cependant, j'ai ajouté ce qui suit au LSApplicationQueriesSchemes de mon info.plist;

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

Toute aide est grandement appréciée?

EDIT 1

C'est le code que j'utilise pour ouvrir 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");
}

basé sur cet exemple.

74
DevC
  1. Votre entrée LSApplicationQueriesSchemes ne devrait contenir que des schémas. Il n'y a aucun point à la deuxième entrée.

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>instagram</string>
    </array>
    
  2. Lire l'erreur. Vous essayez d'ouvrir l'URL avec une faute de frappe dans le schéma. Fixez votre référence à instragram dans votre appel à canOpenURL:.

172
rmaddy

Pour Facebook qui a besoin de:

<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>
6
Ofir Malachi

Mettez seulement <string>instagram</string>. Ce n'est pas nécessaire le chemin complet mais la base de l'URL du schéma.

5
Andr3a88