7

我想在我的 iOS 应用程序中实现原生 Snapchat 应用程序。我已经通过使用 URL 方案在 Facebook 和 Twitter 上做到了这一点。但我无法为 Snapchat 找到这样的东西。

我找到了一些可以在 Safari 中打开 Snapchat “见下文”,但我需要该方案本身,在此先感谢。

 https://www.snapchat.com/add/ProfileName
4

3 回答 3

3

假设应用程序已安装,您可以使用以下命令添加特定用户:

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

将用户名替换为所需的用户名

于 2017-11-02T21:02:03.167 回答
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)

    }
于 2019-12-16T09:27:46.460 回答
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.

于 2017-07-18T18:52:00.367 回答