0

I'm using Unity 2019.3.2f1 and, after updating UnityAds to 3.4.4, there are some errors.

duplicate symbol '_NetworkChange' in:

/Users/Desktop/UnityAdsTest/ios/Libraries/libiPhone-lib.a(SSRVConnectivityMonitor.o)
/Users/Desktop/UnityAdsTest/ios/Frameworks/Plugins/iOS/UnityAds.framework/UnityAds(UnityAds)

duplicate symbol '_kChinaIsoAlpha2Code' in:

/Users/Desktop/UnityAdsTest/ios/Libraries/libiPhone-lib.a(SSRVSdkProperties.o)
/Users/Desktop/UnityAdsTest/ios/Frameworks/Plugins/iOS/UnityAds.framework/UnityAds(UnityAds)

duplicate symbol '_kChinaIsoAlpha3Code' in:

/Users/Desktop/UnityAdsTest/ios/Libraries/libiPhone-lib.a(SSRVSdkProperties.o)
/Users/Desktop/UnityAdsTest/ios/Frameworks/Plugins/iOS/UnityAds.framework/UnityAds(UnityAds)

ld: 3 duplicate symbols for architecture arm64

I have try create new project, the problem still there. Repeat method:

  1. Create new Unity project.
  2. Import UnityAds from Package Manager, the version update to 3.4.4
  3. build iOS project.
  4. Run in XCode.

I don't enable the UnityAds server, and only one UnityAds.framework file in the XCode. It looks like some content is packed into the libiPhone-lib.a.

Has anyone encountered the same problem?

AMeng
  • 1

1 Answers1

0

I solved this problem by remove that 3 symbols from UnityAds.framework:

First,write down the follewing 3 lines to "sym_need_remove.txt"

 _NetworkChange
 _kChinaIsoAlpha2Code
 _kChinaIsoAlpha3Code

And then, extract the lib and remove that 3 symbols

cd UnityAds.framework
lipo UnityAds -thin arm64 -output UnityAds-64.a
strip -u -S -R sym_need_remove.txt UnityAds-64.a

If you need to support armv7 and arm64 at the same time, you also need:

lipo UnityAds -thin armv7 -output UnityAds-v7.a
strip -u -S -R sym_need_remove.txt UnityAds-v7.a
lipo -create UnityAds-64.a UnityAds-v7.a -output UnityAdsStrip.a

Finally, replace UnityAds-64.a or UnityAdsStrip.a back to UnityAds.framework/UnityAds

it will working.

I hope this could help~

ZLM
  • 1