7

I'd like to implement the native Snapchat App into my iOS Application. I've already done that with Facebook and Twitter by using the URL Schemes. But I weren't able to find such thing for Snapchat.

I found something to open Snapchat in Safari "see it below below", but i need the scheme itself, thanks in advance.

 https://www.snapchat.com/add/ProfileName
Mutawe
  • 6,464
  • 3
  • 47
  • 90

3 Answers3

3

You can use the following to add a specific user assuming the app is already installed:

NSURL *snapchatURL = [NSURL URLWithString:@"https://www.snapchat.com/add/username"];
if([[UIApplication sharedApplication] canOpenURL:snapchatURL])
{
    [[UIApplication sharedApplication] openURL:snapchatURL];
}

Replace username with the desired user's name

ara1181
  • 43
  • 3
3
    let username = "USERNAME"
    let appURL = URL(string: "snapchat://add/\(username)")!
    let application = UIApplication.shared

    if application.canOpenURL(appURL) {
        application.open(appURL)

    } else {
        // if Snapchat app is not installed, open URL inside Safari
        let webURL = URL(string: "https://www.snapchat.com/add/\(username)")!
        application.open(webURL)

    }
2

I'm doing it like this:

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

Also added snapchat to LSApplicationQueriesSchemes in plist.

JanB
  • 904
  • 9
  • 14
  • 1
    it's working but can i make it ask to add specific profile ? like ( do you want to add username ) ? – Muhammed Oct 11 '17 at 13:11