2013-05-04 7 views
5

Um ein Facebook india Profil zu öffnen, kann ich verwenden:öffnen Link zu Instagram india

NSURL *url = [NSURL URLWithString:@"fb://profile/<id>"]; 
[[UIApplication sharedApplication] openURL:url]; 

Gibt es eine Möglichkeit, die gleiche Sache für ein Profil Instagram zu tun?

Antwort

23

Das folgende Snippet öffnet Instagram App auf Ihrem Gerät mit UserName.

Objective C

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

Swift

var instagramURL: NSURL = NSURL(string: "instagram://user?username=USERNAME") 
if UIApplication.sharedApplication().canOpenURL(instagramURL) { 
    UIApplication.sharedApplication().openURL(instagramURL) 
} 

Swift 3,0

let instagramURL:URL = URL(string: "instagram://user?username=USERNAME")! 
if UIApplication.shared.canOpenURL(instagramURL) { 
    UIApplication.shared.open(instagramURL, options:[:], completionHandler: { (Bool) in 
     print("Completion block") 
    }) 
} 

wenn Sie mehr wollen Details darüber können Sie folgen Documentation link

+0

Wie können wir Profilinformationen wie Benutzername und Benutzer-E-Mail-ID erhalten .. kann jemand dieses Problem lösen – sabir

+0

bitte gehen Sie über diesen Link erhalten Sie Ihre Antwort in Documentaion von Instagram http: // instagram.com/developer/authentication/# –

+0

Haben Sie eine Probe können Sie bitte senden Sie mir bin sehr neu zu IOS – sabir

Verwandte Themen