从 Unity 到 Xcode 构建的 Unity Ads 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35723861/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unity Ads error from Unity to Xcode build
提问by Clive Smith
I recently built my project fine from Unity to Xcode and it ran perfectly well. Since then I have added the Unity ads to my project in Unity (and then realised I no longer need that as it comes inside of unity 5.3 with Services) so I removed the download. However when I built to Xcode I notice 2 Unity Ads in the frameworks that are linked when built. I get this error:
我最近从 Unity 到 Xcode 构建了我的项目,并且运行得非常好。从那以后,我在 Unity 中将 Unity 广告添加到我的项目中(然后意识到我不再需要它,因为它包含在带有服务的 Unity 5.3 中),所以我删除了下载。但是,当我构建到 Xcode 时,我注意到构建时链接的框架中有 2 个 Unity Ads。我收到此错误:
/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)
/Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D36295805BDo22 /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC25E7A8DF0重复符号 _OBJC_CLASS_$_UnityAdsUnityWrapper 在:/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-498DF02E7A. o 重复符号 _OBJC_METACLASS_$_UnityAdsUnityWrapper 在:/Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objectss /armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Objects-iPhone /armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o 重复符号 _UnityAdsCreateNSString 在:/Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D36295805BDo22 /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC25E7A8DF0重复符号 _OBJC_IVAR_$_UnityAdsUnityWrapper._gameId 在:/Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects正常/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-498DF02E7A. o ld:架构 armv7 clang 的 5 个重复符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
I tried to remove one of the linked library Unity Ads but still get the same error, any ideas?
我试图删除链接库 Unity Ads 之一,但仍然出现相同的错误,有什么想法吗?
回答by Beno?t Freslon
回答by Flagship Dynamics
I had the same issue with a different but still newer Unity release. I upgraded to the latest today and still had the problem. There's a free Unity store package called 'Package Uninstaller' - grab that and use it to search for 'Ads'. Once you do, it exposes where the Unity Ads original and 2.0 are located if they are still in your package. As ikoukas says, you need to delete the Unity Ads files. I deleted ALL of them. Then, my build worked and the errors were gone.
我在使用不同但更新的 Unity 版本时遇到了同样的问题。我今天升级到最新的,仍然有问题。有一个名为“Package Uninstaller”的免费 Unity 商店包 - 抓住它并使用它来搜索“广告”。完成后,它会显示 Unity Ads 原版和 2.0 所在的位置(如果它们仍在您的包中)。正如 ikoukas 所说,您需要删除 Unity Ads 文件。我删除了所有这些。然后,我的构建工作并且错误消失了。
回答by Beno?t Freslon
Actually that means there is 2 UnityAds library added in the Unity Project.
实际上,这意味着在 Unity 项目中添加了 2 个 UnityAds 库。
Don't add the lib from the Asset Store. Just open the Services panel and activate UnityAds.
不要从 Asset Store 添加 lib。只需打开服务面板并激活 UnityAds。
回答by The Judge
Alright, Here is the answer everyone has been waiting for. The question remains,
好了,这就是大家期待已久的答案。问题依旧,
"Why is unity ads creating a duplicate symbols for arm64/arm7?"
“为什么统一广告会为 arm64/arm7 创建重复的符号?”
After 3 years, I ran into this problem with a "hair ripping out" experience. It wasn't nice.. But what I did to solve this issue was to disable "built-in Ads extension" in Unity Ads Services.
3年后,我遇到了“脱发”经历的这个问题。这不太好.. 但我为解决这个问题所做的是在 Unity Ads Services 中禁用“内置广告扩展”。
But before you go a head and do that, you gotta understand why it worked for me! When you enable unity built-in ad extension, Unity sort of installs a plugin that handles all the ads for you. Most people then go ahead and install another plugin from the asset store, which then creates files that collide with each other, and Xcode is therefore screwed and doesn't know what to do.. That being said, if you wanna use an Ad plugin from the asset store, make sure "built-in Ads extension" (in unity ad services) is disabled, but if you just wanna use the built-in ads extension in the unity ad services, you need to make sure every plugin that you got from the asset store that handles ads is uninstalled!
但在你开始这样做之前,你必须明白为什么它对我有用!当您启用 Unity 内置广告扩展程序时,Unity 会安装一个插件来为您处理所有广告。大多数人然后继续从资产商店安装另一个插件,然后创建相互冲突的文件,因此 Xcode 被搞砸了,不知道该怎么做......话虽如此,如果你想使用广告插件从资产商店,确保禁用“内置广告扩展”(在统一广告服务中),但如果您只想在统一广告服务中使用内置广告扩展,则需要确保您使用的每个插件从处理广告的资产商店得到的被卸载了!
回答by Максим Нарчук
- Select "Window/Package Manager"
- Find in tab "In Project" module "Ads"
- Remove "Ads" module
- Go to Assets store
- Reimport "Unity Monetization X.X"
- 选择“窗口/包管理器”
- 在“项目中”模块“广告”选项卡中查找
- 删除“广告”模块
- 前往资产商店
- 重新导入“Unity Monetization XX”
回答by Roberto
I had this problem when trying to replace the Package Manager version with an Asset Store version (for some reason the Asset Store had a newer version).
我在尝试用 Asset Store 版本替换 Package Manager 版本时遇到了这个问题(由于某种原因,Asset Store 有一个更新的版本)。
I just had to unmark the Enable built-in Ad extension
in the Ads settings in Unity:
我只需要Enable built-in Ad extension
在 Unity 的 Ads 设置中取消标记:
Then I also had to initialize the plugin myself calling Advertisement.Initialize(gameId)
where gameId
is notthe Unity Project Id
然后我还必须自己初始化插件,调用Advertisement.Initialize(gameId)
where gameId
is notthe Unity Project Id
回答by Ratana Ly
I found a workaround.
我找到了一个解决方法。
Open the Xcode project select the UnityAdsUnityWrapper.mm in the UnityAds folder Then uncheck the Target membership Unity-Iphone
打开Xcode工程选择UnityAds文件夹中的UnityAdsUnityWrapper.mm 然后取消勾选Target members Unity-Iphone
回答by WilkyRL
I have had this issue before, but I know how to solve it.
我以前遇到过这个问题,但我知道如何解决它。
When I imported unity ads for my own project, I somehow got two of the same files downloaded, which messed things up. In yourerror message, it says
当我为自己的项目导入统一广告时,不知何故我下载了两个相同的文件,这把事情搞砸了。在您的错误消息中,它说
Phone.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)
Phone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o ld:架构 armv7 clang 的 5 个重复符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
Note the line "duplicate symbols". This means you have an extra file of the architecture. Try deleting one of the two duplicates. Anyway, good luck!
注意“重复符号”这一行。这意味着您有一个额外的架构文件。尝试删除两个重复项之一。不管怎样,祝你好运!
回答by ikoukas
I had the same problem. It seems I had a library of UnityAdsUnityWrapper.mm +.h in my "Plugins/iOS" directory. Try searching 'UnityAds' in your project and remove related library files.
我有同样的问题。我的“插件/iOS”目录中似乎有一个 UnityAdsUnityWrapper.mm +.h 库。尝试在您的项目中搜索“UnityAds”并删除相关的库文件。