UnityAdsUnityWrapper.mm imported twice in the Xcode project

Hello,

I just installed UnityAds on Unity 2017.2.0.3f

And the UnityAdsUnityWrapper.mm imported twice in the Xcode project

I got this error on Xcode:

/Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _OBJC_CLASS_$_UnityAdsUnityWrapper in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _OBJC_METACLASS_$_UnityAdsUnityWrapper in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _UnityAdsCreateNSString in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _OBJC_IVAR_$_UnityAdsUnityWrapper._gameId in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o ld: 5 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I just found a workaround: Uncheck the Classes/UnityAds/UnityAdsUnityWrapper.mm on the Target membership in Xcode

1 Like

Hi,

Can you describe the steps how you integrated Unity Ads to your project?

Hello,
I Imported UnityAds from the Asset Store then I build to Xcode.

1 Like

@BenoitFreslon thank you so much for the workaround you found. Are you still having to do this every time you build for ios? I am. @mikaisomaa did you have any insight on this?

1 Like

I can confirm that this is still happening as of this post. I incorporated Unity Ads through the Services panel and then imported the Unity Ads package on the Asset Store. My code uses the Unity Ads in the most generic way to show one single rewarded ad, and I’m using the UnityEngine.Advertisement namespace in a single C# object (nothing but simple Initialize() and Show() methods). When I build to iOS and open in XCode, the UnityAds.framework is listed twice under “Linked Frameworks and Libraries” and the project build Fails as described by above by @BenoitFreslon who just saved me from losing about 3 weeks of work. I hope @mikaisomaa or another Unity official can help to put some documentation and clarity around this for others.

2 Likes

I also encountered this problem.I must Uncheck the Classes/UnityAds/UnityAdsUnityWrapper.mm on the Target membership in Xcode everytime.It is especially troublesome.I feel it is related to the setting of these files “Plugins/iOS/UnityAdsUnityWrapper” and “UnityAds/UnityEngine.Advertisements.iOS.dll”.

1 Like

I just experienced this issue as well. The workaround works but I’m still wondering why the UnityAdsUnityWrapper.mm causes this error in Xcode. I’m also wondering if there is a more permanent fix.

I’ve tried to delete the Advertisment folder from packages folder in Project window, then open packages panel and install previous version of Advertisment - verified (then it renamed to “Ads”, in project - com.unity.ads) and now xcode haven’t any error. Maybe it should help you too