7

Is there a way to open a TikTok user profile in the TikTok app instead of directing to the browser from our app? Let's use Twitter example as they allow it:

twitter://user?screen_name=(username)

D. B.
  • 488
  • 1
  • 10
  • 20
  • There may or may not be a custom URL scheme associated with any given third-party app. However, if it's not publicly documented, you won't be able to do this (redirect to Safari instead) or will have to reverse-engineer it yourself. – Bradley Mackey Jan 26 '20 at 13:00
  • Just tested basic browser URL and if the app is installed on the phone it moves you straight to the app. "https://www.tiktok.com/@\(username)". – D. B. Jan 26 '20 at 15:32

3 Answers3

5

The solution was found. If the app is installed on the phone and you try to launch a TikTok profile from

https://www.tiktok.com/@(username)

it will redirect you to the chosen profile in the app.

D. B.
  • 488
  • 1
  • 10
  • 20
0

Just open the TikTok url for the username

Objective-C

NSURL *url = [NSURL URLWithString:@"https://www.tiktok.com/@tiktokusername"];
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];

Swift

 UIApplication.shared.open(URL(string: "https://www.tiktok.com/@tiktokusername")!, options: [:], completionHandler: nil)
DJTano
  • 1,055
  • 12
  • 12
0

Okey, so had similar issue. I have a link to a tiktok profile to open the app:

let tiktokUrl = "tiktok://@userName"

Was opening like that:

    let application = UIApplication.shared
        guard let url = URL(string: tiktokUrl) else { return }
        if application.canOpenURL(url) {
            application.open(url, options: [:], completionHandler: nil)
            return
        }
    }

It was working for a long time. But we just noticed, that now (not sure on which iOS exactly) it started to open only TikTok app, and not the profile

The fix is: fix URL. It should be: From:

let tiktokUrl = "tiktok://@userName"

To:

let appUrl = "https://www.tiktok.com/@userName

And opening, just use .open:

From:

application.open(url, options: [:], completionHandler: nil)

To:

application.open(url)

So 2 things to fix: URL address so it is https://www.tiktok.com/@userName and HOW you open. Do not pass these options and completionHandler, as with these it will still open only the TikTok app.

By the way, the previous way I used still works for all other social networks: youtube, facebook, Instagram, but I had issues ONLY with tiktok.

Hope that will save someones time in the future

Jkrist
  • 748
  • 1
  • 6
  • 24