iOS Sharing Documentation


Sharing allows users to share videos and photos from your app to TikTok. Make sure your app has access to Photo Library.


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 TikTokOpenPlatformShareRequest.h

#import <TikTokOpenPlatformSDK/TikTokOpenPlatformShareRequest.h>

Step 2 : Construct a Share Request

Construct a share request with type TikTokOpenPlatformAppTypeI18N.

TikTokOpenPlatformShareRequest *req = [[TikTokOpenPlatformShareRequest alloc] initWithAppType:TikTokOpenPlatformAppTypeI18N];

Please use designated initializer -[TikTokOpenPlatformShareRequest initWithAppType:]. The initializer method-TikTokOpenPlatformShareRequest init is unavailable.

Step 3 : Required Parameters

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

req.mediaType = TiktokOpenPlatformShareMediaTypeImage;
req.mediaType = TiktokOpenPlatformShareMediaTypeVideo;

Set share localIdentifiers as PHAsset.


NSMutableArray<NSString *> *mediaLocalIdentifiers = [NSMutableArray array];
for (PHAsset *asset in self.selectedAssets) {
    [mediaLocalIdentifiers addObject:asset.localIdentifier];
req.localIdentifiers = [mediaLocalIdentifiers copy];


  • 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

Hashtag (waiting for release)

To associate your video with a hashtag, set the hashtag property on the request.

req.hashtag = @"agechallenge";

Note: But now this feature is not yet released, and passing in this parameter will be ignored.


You can customize a string to identify a share. The same state will be present in the respond. You can bind you information with this ShareID.

req.state = @"a47e57c6c559acb88a9569da66ee5f65e0f779c9";

Step 5 : Send Share Request

Call -[TikTokOpenPlatformShareRequest 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

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

0TiktokOpenPlatformSuccessshared success
TiktokOpenPlatformErrorCodeCommon-1Common error type e.g. network error
TiktokOpenPlatformErrorCodeUserCanceled-2User Canceled share in TikTok
TiktokOpenPlatformErrorCodeSendFailed-3User pubilsh content Failed
TiktokOpenPlatformErrorCodeAuthDenied-4Auth Denied,

If the error code does not make it easy for you to locate a specific error, you can use 'respond.shareState` for detail message. SDK version need 2.0.8 or higher.

The following map defines the Sharing state and specific issues.

TiktokShareRespStateUnknownError20001Unknown or current SDK version unclassified error
TiktokShareRespStateParamValidError20002Params parsing error, media resource type difference you pass
TiktokShareRespStateSharePermissionDenied20003Not enough permissions to operation.
TiktokShareRespStateUserNotLogin20004User not login
TiktokShareRespStateNotHavePhotoLibraryPermission20005TikTok has no album permissions
TiktokShareRespStateNetworkError20006TikTok Network error
TiktokShareRespStateVideoTimeLimitError20007Video length doesn't meet requirements
TiktokShareRespStatePhotoResolutionError20008Photo doesn't meet requirements
TiktokShareRespTimeStampError20009Timestamp check failed
TiktokShareRespStateHandleMediaError20010Processing photo resources faild
TiktokShareRespStateVideoResolutionError20011Video resolution doesn't meet requirements
TiktokShareRespStateVideoFormatError20012Video format is not supported
TiktokShareRespStateCancel20013Sharing canceled
TiktokShareRespStateHaveUploadingTask20014Another video is currently uploading
TiktokShareRespStateSaveAsDraft20015Users store shared content for draft or user accounts are not allowed to post videos
TiktokShareRespStatePublishFailed20016Post share content failed
TiktokShareRespStateMediaInIcloudError21001Downloading from iCloud faild
TiktokShareRespStateParamsParsingError21002Internal params parsing error
TiktokShareRespStateGetMediaError21003Media resources do not exist