David Schmoecker
David Schmoecker

Reputation: 609

canOpenURL: failed for URL: "instagram://app" - error: "(null)

I get this error:

-canOpenURL: failed for URL: "instagram://app" - error: "(null)"

This is the code I use:

let instagramURL = NSURL(string: "instagram://app")!     
if (UIApplication.sharedApplication().canOpenURL(instagramURL)) {
    //some code
}

I added LSApplicationQueriesSchemes to my info.plist file

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

And it seems to "recognise" the instagram scheme, cause when I use something else like "instagraam" I get a different error message (which makes sense):

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

Am I missing something obvious?

Upvotes: 3

Views: 2879

Answers (1)

David Schmoecker
David Schmoecker

Reputation: 609

As pointed out in the comments - this is in fact a duplicate of this.

On a real device it works, it's just weird output of the simulator.

Upvotes: 2

Related Questions