casillas
casillas

Reputation: 16793

Open the instagram app via my app

I am trying to open the instagram app from my application and implemented the following code, but it does not do anything. I have instagram app installed on my iphone.

NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
   [[UIApplication sharedApplication] openURL:instagramURL];
}

Upvotes: 0

Views: 200

Answers (1)

Lal Krishna
Lal Krishna

Reputation: 16160

Update info.plist for Key LSApplicationQueriesSchemes

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

Code:

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    [[UIApplication sharedApplication] openURL:instagramURL];
}

Refer instagram docs

Upvotes: 2

Related Questions