Open native Snapchat App from my Application
Asked Answered
S

3

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
Samanthasamanthia answered 11/4, 2016 at 8:13 Comment(1)
did you tried to add snapchat to LSApplicationQueriesSchemes as @Kirualex saidKoh
C
4
    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)

    }
Complacence answered 16/12, 2019 at 9:27 Comment(0)
S
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

Shipshape answered 2/11, 2017 at 21:2 Comment(0)
I
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.

Ira answered 18/7, 2017 at 18:52 Comment(1)
it's working but can i make it ask to add specific profile ? like ( do you want to add username ) ?Jook

© 2022 - 2024 — McMap. All rights reserved.