Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open native Snapchat App from my Application

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
like image 515
Mutawe Avatar asked Apr 11 '16 08:04

Mutawe


3 Answers

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

like image 125
ara1181 Avatar answered Nov 14 '22 01:11

ara1181


    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)

    }
like image 28
Khaled Khaldi Avatar answered Nov 13 '22 23:11

Khaled Khaldi


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.

like image 2
JanB Avatar answered Nov 14 '22 00:11

JanB