简体   繁体   中英

Share on TikTok [Video Kit] - Swift

Background: I am working on animated video making application. Once a user generate their video than we save that video inside their local storage. Now I want to provide new feature of sharing that video on TikTok.

For adding TikTok sharing feature I am following the TikTok SDK .

Issue: According to this documentation, I have to implement the function that is taking asserts as parameters. I am having the url of video that is created by user. How do I convert mp4 video or url into assets?

Code: Set share localIdentifiers as PHAsset.

var mediaLocalIdentifiers: [String] = []

for asset in self.selectedAssets {

    mediaLocalIdentifiers.append(asset)

}

request.localIdentifiers = mediaLocalIdentifiers

Link to this function

Error:

TikTokOpenSDKErrorCodeUserCanceled | -2 | User Canceled share in TikTok. TikTokOpenSDKShareRespStateParamValidError| 20002 | Params parsing error.

Kindly help me with converting url into assets or if someone has applied TikTok sharing feature, please help me out.

Once a user generate their video than we save that video inside their local storage

Well, there's your problem right there. The SDK function you have pointed to expects the video to be in the photos library, not in the user's local storage. That is what makes the video available through an asset (a PHAsset).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM