Skip to main content
TikTok for Developers


Share Kit for iOS

This guide explains how to integrate your app with Share Kit. Long videos with a duration of up to ten minutes can be shared. The allowed duration may vary based on the region.


Before proceeding, you must complete all the steps in iOS Quickstart.

Obtain the client_key located in the Appdetails section of your app on the TikTok for Developers website. Then add Share Kit to your app by navigating to the Manage apps page, and clicking + Add products.

Your app must have access to the user's photo library to successfully share videos to TikTok.

Create a share request and handle responses

For the following steps, your app is required to maintain a strong reference to the request to receive the response callback. You can discard it once you have handled the response.

  1. Import the TikTokOpenShareSDK module and create a share request, as shown in the code snippet below. In the share request object, set the following parameters:
  • localIdentifiers: List of media. Media can either be all videos or all images.
  • mediaType: The type of media you want to share.
  • redirectURI: Universal link that's used to callback to your application
  1. Start the share by calling the send(_:) method on the share request object.
  2. After the user finishes sharing, you will receive a response callback in the closure. In the share response object, you can find whether the share succeeded or failed.
/* Step 1 */
import TikTokOpenShareSDK

let shareRequest = TikTokShareRequest(localIdentifiers: [...], 
                                      mediaType: .video, 
                                      redirectURI: "")
/* Step 2 */
shareRequest.send { response in
    /* Step 3 */
    let shareResponse = response as? TikTokShareResponse else { return }
    if shareResponse.errorCode == .noError {
        print("Share succeeded!")
    } else {
        print("Share Failed! 
               Error Code: \(shareResponse.errorCode.rawValue) 
               Error Message: \(shareResponse.errorMessage ?? "") 
               Share State: \(shareResponse.shareState)")

Alternatively, you can pass in a nil completion handler to the share request and create a TikTokShareResponse directly from the URL sent back by TikTok in the application(_:continue:restorationHandler:) AppDelegate function. In this case, you do not have to maintain a strong reference to the authorization request.

After a successful sharing session, a dialog will prompt the user to either go back to their app or stay in TikTok.

Share formats

You can use the shareFormat field in the share request object to share images or videos to TikTok in different formats. If shareFormat is not set, it will be .normal by default

  • .normal: The default share format. This format allows your app to share images or videos, as is, to TikTok.
  • .greenScreen: See Green Screen for more details.


  • The aspect ratio of images or videos should be between 1/2.2 and 2.2.
  • A maximum of 35 images can be shared.
  • A maximum of 12 videos can be shared.
  • You must be authorized to use any TikTok brand logos and watermarks. See TikTok Brand and Use Guidelines for more details.

Handling errors

When an error occurs, the response will have an error code with the following mapping:

Error Code



Shared success.


Common error type e.g. network error.


User Canceled share in TikTok.


User publish content failed.


Share denied.



Below is a mapping of the shareState which provides a more detailed explanation of the error:

Share state





Unknown or current SDK version unclassified error.


Params parsing error.


Permission not granted


User not logged in.


TikTok has no album permissions.


TikTok Network error.


Video length doesn't meet requirements.


Photo doesn't meet requirements.


Time stamp check failed.


Processing photo resources failed.


Video resolution doesn't meet requirements.


Video format is not supported.


Sharing canceled.


Another video is currently uploading.


User saved the shared content as a draft


Posting failed


Downloading from iCloud failed.


Internal params parsing error.


Media resources do not exist.

TikTok for Developers