tiktok / tiktok-opensdk-ios

The TikTok OpenSDK features Login Kit and Share Kit which allow your users to log in using their TikTok account and share content from your app to TikTok.
https://developers.tiktok.com
Other
65 stars 20 forks source link

Shared images through TikTokShareRequest are in a wrong order #15

Closed zepojo closed 5 months ago

zepojo commented 9 months ago

Hello there.

When I share multiple images through a TikTokShareRequest to have a carousel post on TikTok, the order of the images matching the supplied local asset identifiers is not kept. From what I've seen so far, it seems that images in the final carousel are in the alphabetical order of their local asset identifiers. For example, if I have this array of identifiers:

[
  "CB651F89-58DB-422D-8A55-CCCA3DA26310/L0/001", // Image 1
  "1C47D10E-4734-4B9F-A575-E40BC4AB3CB3/L0/001", // Image 2
  "26DBD447-6846-4CC7-AFEA-775DCE63EF90/L0/001" // Image 3
]

and pass it to a share request like so:

TikTokShareRequest(localIdentifiers: identifiers, mediaType: .image, redirectURI: <my_url>)

The images will appear inside the carousel in the TikTok app in this order:

[
  "1C47D10E-4734-4B9F-A575-E40BC4AB3CB3/L0/001", // Image 2
  "26DBD447-6846-4CC7-AFEA-775DCE63EF90/L0/001" // Image 3
  "CB651F89-58DB-422D-8A55-CCCA3DA26310/L0/001", // Image 1
]

The bug seems to be on TikTok app side, as the identifiers are still in the right order inside the deeplink launching it:

https://www.tiktok.com/opensdk/share/?request_id=EF[...]&media_paths=CB651F89-58DB-422D-8A55-CCCA3DA26310/L0/001,1C47D10E-4734-4B9F-A575-E40BC4AB3CB3/L0/001,26DBD447-6846-4CC7-AFEA-775DCE63EF90/L0/001&bundle_id=[...]
stephen-boyle commented 9 months ago

Hi @zepojo , I found the cause for this issue. The fix for it will be available in TikTok version 31.8.0