Search Unity

UnityAdsUnityWrapper.mm imported twice in the Xcode project

Discussion in 'Unity Ads & User Acquisition' started by BenoitFreslon, Oct 25, 2017.

  1. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    163
    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:
    Code (CSharp):
    1. /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
     

    Attached Files:

    nick_LoS likes this.
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    365
    Hi,

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

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    163
    Hello,
    I Imported UnityAds from the Asset Store then I build to Xcode.
     
    nick_LoS likes this.
  4. penneyworth1

    penneyworth1

    Joined:
    Feb 7, 2015
    Posts:
    13
    @badben 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?
     
    nick_LoS likes this.
  5. Blingdingo

    Blingdingo

    Joined:
    Jan 10, 2018
    Posts:
    1
    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 @badben 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.
     
    shengming-qi and nick_LoS like this.
  6. zhouxing

    zhouxing

    Joined:
    Aug 22, 2015
    Posts:
    5
    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”.
     
    nick_LoS likes this.
  7. nick_LoS

    nick_LoS

    Joined:
    Mar 11, 2018
    Posts:
    1
    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.
     
  8. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    49
    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