Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

error: linker command failed - Unity 2017.3.0f3 + Unity Ads 2.2.0

Discussion in 'Unity Ads' started by _petak_, Mar 13, 2018.

  1. _petak_

    _petak_

    Joined:
    Nov 19, 2012
    Posts:
    43
    Hi to all,

    I have issue with iOS build + Unity Ads package, when I try to build very simple test application of Unity Ads with Xcode I'm always getting these linker error:

    Code (csharp):
    1.  
    2. duplicate symbol _UnityAdsCopyString in:
    3.  
    4.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-6D362980BD529555.o
    5.  
    6.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-5A58B2CEE8B214AA.o
    7.  
    8. duplicate symbol _OBJC_CLASS_$_UnityAdsUnityWrapperDelegate in:
    9.  
    10.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-6D362980BD529555.o
    11.  
    12.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-5A58B2CEE8B214AA.o
    13.  
    14. duplicate symbol _OBJC_METACLASS_$_UnityAdsUnityWrapperDelegate in:
    15.  
    16.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-6D362980BD529555.o
    17.  
    18.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-5A58B2CEE8B214AA.o
    19.  
    20. ld: 3 duplicate symbols for architecture arm64
    21.  
    I'm using Unity 2017.3.0f3 + Unity Ads 2.2.0 + Xcode 9.2.
    Do you have any ideas how to solved this error ?

    Thank you for any tips or advice.
     
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    274
    Hi,

    Thanks for bringing this up!

    Do you by chance have Unity Ads integrated from the Asset Store and also the Services window?

    Please disable the Ads integration from the Services window and let me know if it helps.
     
    onHead likes this.
  3. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    1,129
    Hi,

    Alternatively try to clean Library and obj folders for your project. We have our own example game released on App Store using almost identical setup: 2017.3.1f1, Ads SDK 2.2.0 and Xcode 9.2

    So have tested and verified an almost similar configuration as yours.

    Let us know if you still need help. You can also see if you can repro using our example project at https://github.com/Unity-Technologies/unity-ads-assetstore-test

    /Rasmus
     
  4. _petak_

    _petak_

    Joined:
    Nov 19, 2012
    Posts:
    43
    Hi mikaisomma,

    thank you for your quick and correct answer, after I tried disable Unity Ads from Unity Editor Services Panel, my Xcode Test project doesn't have any build linker error.

    So thank you so much! And sorry for my late answer.

    Ps.: I make my own fix with Editor API and Xcode API, which is great for future...
    https://bitbucket.org/Unity-Technologies/xcodeapi

    but your solution is so sharp and clean ;-)

    Code (csharp):
    1.  
    2. using System.IO;
    3. using UnityEditor;
    4. using UnityEditor.Callbacks;
    5. using UnityEditor.iOS.Xcode;
    6. using UnityEngine;
    7.  
    8. public static class RemoveUnityAdsXcode
    9. {
    10.    [PostProcessBuild]
    11.    public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
    12.    {
    13.       if (buildTarget != BuildTarget.iOS)
    14.          return;
    15.  
    16.      
    17.       string[] filesToRemove = {
    18.          "Classes/UnityAds/UnityAdsUnityWrapper.mm"
    19.       };
    20.  
    21.       string pbxprojPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
    22.       PBXProject proj = new PBXProject();
    23.       proj.ReadFromString(File.ReadAllText(pbxprojPath));
    24.  
    25.       foreach(string name in filesToRemove)
    26.       {
    27.          string fileGuid = proj.FindFileGuidByProjectPath(name);
    28.          if (fileGuid != null)
    29.          {
    30.             Debug.Log ("Removing " + name + " from xcode project");
    31.             proj.RemoveFile(fileGuid);
    32.          }
    33.       }
    34.  
    35.       File.WriteAllText(pbxprojPath, proj.WriteToString());
    36.    }
    37. }
    38.  
    39.