Skip to main content
TikTok for DevelopersTikTok for Developers


Video Kit with Swift


Video Kit allows users to share videos and photos from your app to TikTok.

Make sure your app has access to Photo Library.

Now we support long video sharing (> 1min) for up to 10 mins. Actual supported video duration may vary based on region.


Before you start sharing, you need to complete all of the configurations listed in Getting Started with the TikTok SDK for iOS.

You can complete the sharing step by step:

Step 1 : Import Header

Import TikTokOpenSDK

import TikTokOpenSDK

Step 2 : Construct a Share Request

Construct a share request.

let request = TikTokOpenSDKShareRequest()

Step 3 : Required Parameters

Set the shared resource type. Currently we support images and videos.

request.mediaType = TikTokOpenSDKShareMediaTypeImage;
request.mediaType = TikTokOpenSDKShareMediaTypeVideo;

Set share localIdentifiers as PHAsset.


var mediaLocalIdentifiers: [String] = []
for asset in self.selectedAssets {
request.localIdentifiers = mediaLocalIdentifiers


  • The aspect ratio of the images or videos should between: [1/2.2, 2.2]
  • If mediaType is Image:
  • The number of images should be more than one and up to 12.
  • If mediaType is Video:
  • Total video duration should be longer than 1 seconds.
  • No more than 12 videos can be shared
  • Videos with brand logo or watermark will lead to the videos being deleted or the respective accounts disabled. Make sure your application shares content without a watermark.

Step 4 : Optional Parameters


You can customize a string to identify a share. The same state will be present in the respond.

You can bind your information with this ShareID.

request.state = "a47e57c6c559acb88a9569da66ee5f65e0f779c9";

Step 5 : Send Share Request

Call -[TikTokOpenSDKShareRequest sendShareRequestWithCompleteBlock:] method to send the share request .

It will open the TikTok app and publish the content. Users can stay in TikTok or go back to your App after sharing.

If the user goes back to your app, you can receive a callback in CompleteBlock

For error handling and debugging, check out the list of Error Codes here.