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

Completion handler never being called after signin in to TikTok #35

Open machadogj opened 1 month ago

machadogj commented 1 month ago

hi there!

I was having an issue where my completion handler was never being called. After some debugging, I noticed that by the time my app delegate's handler was being called, the "requests" NSMapTable in TikTokAPI was empty, thus it never handled responses.

I managed to fix this problem by changing the following line:

private static var requests: NSMapTable<NSString, TikTokBaseRequest> = NSMapTable.strongToWeakObjects()

to the following:

private static var requests: NSMapTable<NSString, TikTokBaseRequest> = NSMapTable.strongToStrongObjects()

I understand this might be difficult to reproduce, but it happened 100% of the times while testing on my iPhone Xr with OS 15.6.1.