react-native-tiktok icon indicating copy to clipboard operation
react-native-tiktok copied to clipboard

'TikTokOpenSDKShareRequest' has different definitions in different modules

Open tldkhang opened this issue 1 year ago • 29 comments

Screen Shot 2022-10-05 at 11 55 22 I use Xcode version 14.0. I can't build the app after installing this library. Has anyone had the same error as me?

tldkhang avatar Oct 05 '22 05:10 tldkhang

Getting the same error after installed. Any fix on that?

JackyKeng avatar Oct 11 '22 03:10 JackyKeng

@JackyKeng @taleduykhang Which version of RN are you using?

Lg0gs avatar Oct 11 '22 06:10 Lg0gs

@Lg0gs , I'm using

RN v0.63.3
react-native-tiktok v1.1.1

JackyKeng avatar Oct 11 '22 07:10 JackyKeng

@JackyKeng @taleduykhang Which version of RN are you using? I'm using "react-native": "0.67.2"

tldkhang avatar Oct 11 '22 07:10 tldkhang

@taleduykhang I've just tried the same version and it worked. Can you remove Podfile.lock and Pods folder and try again?

Lg0gs avatar Oct 12 '22 08:10 Lg0gs

@Lg0gs Thanks for your feedback, I will try this way

tldkhang avatar Oct 12 '22 08:10 tldkhang

@taleduykhang I've just tried the same version and it worked. Can you remove Podfile.lock and Pods folder and try again?

Thanks for suggestion. Same error and it didn't work for me.

Alisa007 avatar Oct 16 '22 21:10 Alisa007

I tried to remove Podfile.lock and Pods folder but still facing the same error. Any alternative solution on this?

JackyKeng avatar Oct 17 '22 08:10 JackyKeng

Same error for me RN v0.67.4 react-native-tiktok v1.1.1 xCode 14.0.1

cmpdvd avatar Oct 17 '22 15:10 cmpdvd

Getting the same error with a fresh project setup.

Steps:

  1. npx react-native init <AppName>
  2. npm install react-native-tiktok
  3. Build IOS, getting error

Environment: react-native: v0.70.3 react-native-tiktok: v1.1.1 TikTokOpenSDK: v5.0.15

image

JackyKeng avatar Oct 20 '22 02:10 JackyKeng

@JackyKeng Did you run pod install?

Lg0gs avatar Oct 20 '22 07:10 Lg0gs

@Lg0gs , yes. After running pod install will install react-native-tiktok: v1.1.1 and TikTokOpenSDK: v5.0.15

JackyKeng avatar Oct 20 '22 07:10 JackyKeng

Same error for me RN v0.67.4 react-native-tiktok v1.1.1 xCode 14.0.1

Maybe error due to Xcode version 14. You try to downgrade Xcode version and try build again

tldkhang avatar Oct 20 '22 07:10 tldkhang

@taleduykhang I was thinking about this too, I'm using XCode 13 version

Lg0gs avatar Oct 20 '22 16:10 Lg0gs

@taleduykhang @Lg0gs Unfortunately on my fresh project setup above, I'm using XCode v13.4.1 :confused:

JackyKeng avatar Oct 21 '22 01:10 JackyKeng

@JackyKeng What's your swift version?

Lg0gs avatar Oct 21 '22 07:10 Lg0gs

@Lg0gs , my swift version swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)

JackyKeng avatar Oct 21 '22 08:10 JackyKeng

@JackyKeng Can you try 5.0? Currently I'm using this version

Lg0gs avatar Oct 21 '22 09:10 Lg0gs

Still looking for a fix.

ZerakPalani avatar Oct 21 '22 21:10 ZerakPalani

I uninstalled this repo and created the same files inside my project as components -> tiktok.tsx, response.tsx, Tiktok.swift, Tiktok.m and now I don't get this issue anymore. I also added pod install TikTokOpenSDK ~> 5.0, however, now I can run expo run:ios without getting this error. The next issue I have is the other issue listed here: https://github.com/Lg0gs/react-native-tiktok/issues/12

ZerakPalani avatar Oct 22 '22 12:10 ZerakPalani

I managed to temporarily fix this in my project. The idea is to make sure react-native-tiktok is using the same TikTokOpenSDKShareRequest definition as my project Pods.

To do that:

  1. I fixed the TiktokOpenSDK version in my project to v5.0.0 by adding pod 'TikTokOpenSDK', '5.0.0' to my project Podfile.
  2. Then I replaced TikTokOpenSDKShareRequest in the react-native-tiktok package with the one in my project Pods folder.
  3. To make this "fix" persist. I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved this issue in my project:

diff --git a/node_modules/react-native-tiktok/ios/Podfile.lock b/node_modules/react-native-tiktok/ios/Podfile.lock
index be8a751..09aea40 100644
--- a/node_modules/react-native-tiktok/ios/Podfile.lock
+++ b/node_modules/react-native-tiktok/ios/Podfile.lock
@@ -2,7 +2,7 @@ PODS:
   - TikTokOpenSDK (5.0.0)
 
 DEPENDENCIES:
-  - TikTokOpenSDK (~> 5.0.0)
+  - TikTokOpenSDK (5.0.0)
 
 SPEC REPOS:
   trunk:
diff --git a/node_modules/react-native-tiktok/ios/Pods/TikTokOpenSDK/TikTokOpenSDK.framework/Headers/TikTokOpenSDKShare.h b/node_modules/react-native-tiktok/ios/Pods/TikTokOpenSDK/TikTokOpenSDK.framework/Headers/TikTokOpenSDKShare.h
index 2e6a412..29b802f 100644
--- a/node_modules/react-native-tiktok/ios/Pods/TikTokOpenSDK/TikTokOpenSDK.framework/Headers/TikTokOpenSDKShare.h
+++ b/node_modules/react-native-tiktok/ios/Pods/TikTokOpenSDK/TikTokOpenSDK.framework/Headers/TikTokOpenSDKShare.h
@@ -9,6 +9,8 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FOUNDATION_EXTERN NSString *const TikTokVideoKitDisableMusicSelectionKey;
+
 typedef NS_ENUM(NSUInteger, TikTokOpenSDKShareMediaType) {
     TikTokOpenSDKShareMediaTypeImage = 0, //!< Map to PHAssetMediaTypeImage
     TikTokOpenSDKShareMediaTypeVideo, //!< Map to PHAssetMediaTypeVideo
@@ -74,10 +76,15 @@ typedef void (^TikTokOpenSDKShareCompleteBlock)(TikTokOpenSDKShareResponse *Resp
 @property (nonatomic, assign) TikTokOpenSDKLandedPageType landedPageType;
 
 /**
-   To associate your video with a hashtag, set the hashtag property on the request. The length cannot exceed 35. You app needs to have access to this feature.
+   To associate your video with a hashtag, set the hashtag property on the request. The length cannot exceed 35. Your app needs to have access to this feature.
  */
 @property (nonatomic, copy) NSString *hashtag;
 
+/**
+    Add extra share options to disable/enable users from adding music, anchors, or effects when sharing to TikTok. If the dictionary is empty, the default will enable users to do what they want.
+ */
+@property (nonatomic, strong) NSDictionary *extraShareOptions;
+
 /**
    The Media type of localIdentifiers in Album, All attachment localIdentifiers must be the same type
  */

Version that I am using RN v0.68.1 react-native-tiktok v1.1.1 TikTokOpenSDK v5.0.0 Xcode v13.4.1

nghaosiong98 avatar Nov 03 '22 06:11 nghaosiong98

Any real fix on that matter ? Same here for me after install 🥺

RN v0.70.5 react-native-tiktok v1.1.1 TikTokOpenSDK v5.0.14 Xcode v14

priscaure avatar Nov 14 '22 08:11 priscaure

@priscaure Try to downgrade the opend sdk to the 5.0.0 version

Lg0gs avatar Nov 16 '22 06:11 Lg0gs

@priscaure, the patch package and downgrade to TikTokOpenSDK v5.0.0 is a real solution. If you want TikTokOpenSDK v5.0.14, create a PR. otherwise, shut the fuck up.

@jeremyspritelyco If you can't reply to people without insulting them, don't bother replying. @Lg0gs offered me a solution without being condescending (Thank you btw). You could've done the same, and in the future grow "the fuck" up.

Have a nice day !

priscaure avatar Nov 28 '22 14:11 priscaure

My case. I commented import TikTokOpenSDK out and it worked.

node_modules/react-native-tiktok/ios/Tiktok.swift

import Foundation
// import TikTokOpenSDK
import Photos

@objc(Tiktok)
class Tiktok: UIViewController {

345ml avatar Dec 12 '22 06:12 345ml

Hi everyone. I struggled to solve the issue for a while and was able to solve the issue clearly in the end. Working well for both 5.0.0 and 5.0.14.

How to fix?

  • Go to node_modules/react-native-tiktok/ios/podfile
   Change 
   pod 'TikTokOpenSDK', '~5.0.14' 
   To
   pod 'TikTokOpenSDK', '5.0.0'  or  pod 'TikTokOpenSDK', '5.0.14' 
  • Delete Podfile.lock and pod install (in node_modules/react-native-tiktok/ios)
  • Go to ios directory of your RN project
  • Delete Podfile.lock and pod install (in ios directory of your RN project)

I believe the issue will never happen anymore.

supershik avatar Jan 05 '23 14:01 supershik

I'm still hitting this issue, I have both set to 5.0.0. Can you help me understand why we need to add the TikTokOpenSDK as both a root Pod as well as a subfolder within the react native project? Cant we just use one?

harryrein3 avatar Jan 25 '23 19:01 harryrein3

Hi Missed one thing

Open react-native-tiktok.podscpec file in node_modules/react-native-tiktok/

Change like this line s.dependency "TikTokOpenSDK", "5.0.0"

Hope it works fine for you.

supershik avatar Jan 25 '23 20:01 supershik

Following @supershik's comments resolved my issue. Thanks @supershik

To persist the changes, it's better to patch using the command npx patch-package react-native-tiktok, which will create a patch file under patches directory.

islamashraful avatar May 25 '23 11:05 islamashraful