AppsFlyerSDK / appsflyer-react-native-plugin

AppsFlyer plugin for React Native
MIT License
278 stars 198 forks source link

[IOS]Duplicate interface definition for class 'AppsFlyerlib' #459

Open viet-nguyen-1926 opened 1 year ago

viet-nguyen-1926 commented 1 year ago

Report

I had Duplicate interface definition for class 'AppsFlyerlib' error in ios

Plugin Version

6.10.2

On what Platform are you having the issue?

IOS

What did you do?

1/Clean yan.lock,node_modules, cache ... 2/update library 6.10.2 in package json 3/ yarn install 4/Remove Podfile.lock then pod install 5/Build in Xcode

What did you expect to happen?

Can build normally

What happened instead?

Can not build Duplicate interface definition for class 'AppsFlyerlib' error in log

Please provide any other relevant information.

image

ray-step commented 1 year ago

I'm running to the same issue. 6.9.4 works fine though.

amit-kremer93 commented 1 year ago

Tried to clean derived data? or remove the plugin, clean the pods and install it again

viet-nguyen-1926 commented 1 year ago

@amit-kremer93 Yes, I always delete it every time I build I have removed plugin then install again then check again but still have bug there

rm -rf ~/Library/Developer/Xcode/iOS DeviceSupport
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Developer/CoreSimulator/Caches
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -fr ios/Pods
rm -fr ios/Podfile.lock
cd ios && pod repo remove trunk&&pod install --repo-update
amit-kremer93 commented 1 year ago

@viet-nguyen-1926 did you manage to solve it?

viet-nguyen-1926 commented 1 year ago

@amit-kremer93 Not yet, Now im using 6.9.4 to avoid that issue for releasing. Not only my app, my friends also have the same.

amit-kremer93 commented 1 year ago

Which RN version and xcode do you use?

amit-kremer93 commented 1 year ago

Try to open Xcode and go to Pods->Development Pods->react-native-appsflyer. Then open the file RNAppsFlyer.h and replace the import statements:

#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>) // from Pod
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif

just with: #import <AppsFlyerLib/AppsFlyerLib.h>

viet-nguyen-1926 commented 1 year ago

@amit-kremer93 I have checked in RN 0.71.6 and Xcode 14.3 I have followed your instructions but the error is still there. I tried another way, I just changed the import path in AppDelegate from #import "AppsFlyerLib.h" to #import <AppsFlyerLib/AppsFlyerLib.h> so i can build normally without any errors

image

What do you think about this way?

ray-step commented 1 year ago

@amit-kremer93 I tried the recommended change and it did not help. I also tried 6.10.3 which seemingly has this change and that one throws the same error.

My RN is 0.71.8, and my Xcode is 14.2.

amit-kremer93 commented 1 year ago

@viet-nguyen-1926 Do you import AppsFlyerLib.h and RNAppsFlyer in your AppDelegate.m?

viet-nguyen-1926 commented 1 year ago

@amit-kremer93 No, i dont. just only import AppsFlyerLib.h in AppDelegate.h

jdbarrera commented 5 months ago

This is still an issue. I attempted the above solutions with no luck. I also tried a solution in this issue thread where we set the No Common Blocks setting to NO which also didn't work. After digging deeper into the build error I found that a previous definition is linked, which is an identical AppsFlyerLib header file, located in a folder called headers. If I try deleting this folder, it gets recreated on build. My knowledge of Xcode and the pod environment stops me here unfortunately, but hopefully this helps reach a solution.

Any help here would be greatly appreciated.

jdbarrera commented 5 months ago

This is still an issue. I attempted the above solutions with no luck. I also tried a solution in this issue thread where we set the No Common Blocks setting to NO which also didn't work. After digging deeper into the build error I found that a previous definition is linked, which is an identical AppsFlyerLib header file, located in a folder called headers. If I try deleting this folder, it gets recreated on build. My knowledge of Xcode and the pod environment stops me here unfortunately, but hopefully this helps reach a solution.

Any help here would be greatly appreciated.

Also, here's some version info: react-native: 0.71.14 react-native-appsflyer: 6.13.1 Xcode: 15.3 iPhone 15, iOS: 17.2