gpt4 book ai didi

ios - 尝试为 iPhone 模拟器构建 Unity 应用程序时出现 Apple Mach O 链接器错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:17:48 25 4
gpt4 key购买 nike

所以我有这个 Unity 应用程序,我想在 iOS 模拟器中测试它。我在构建之前在Unity中选择了模拟器sdk。我已经在 Play 商店中发布了该应用程序的 Android 版本。

无论如何,我无法在 Xcode 中构建它。我不断收到这 3 个构建错误:

ld: warning: ignoring file /Users/myaccount/Desktop/untitled 
folder/Libraries/libChartboost.a, missing required architecture i386 in file
/Users/danmelamed/Desktop/untitled folder/Libraries/libChartboost.a (2 slices)
ld: warning: ignoring file /Users/myaccount/Desktop/untitled
folder/Libraries/libSoomlaIOSStore.a, missing required architecture i386 in file
/Users/myaccount/Desktop/untitled folder/Libraries/libSoomlaIOSStore.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CBAnalytics", referenced from:
objc-class-ref in ChartBoostBinding.o
"_OBJC_CLASS_$_Chartboost", referenced from:
objc-class-ref in ChartBoostBinding.o
objc-class-ref in ChartBoostManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

"_OBJC_CLASS_$_CBAnalytics", referenced from:

objc-class-ref in ChartBoostBinding.o

"_OBJC_CLASS_$_Chartboost", referenced from:

objc-class-ref in ChartBoostBinding.o

objc-class-ref in ChartBoostManager.o

ld: symbol(s) not found for architecture i386

如何让 chartboost 在模拟器架构中运行?或者如果没有,我如何禁用 chartboost 以便我可以在没有它的情况下测试我的应用程序?我没有任何 iOS 设备。所以我只能在模拟器上测试。

我还尝试在 Xcode 中运行 Unity 中的常规 sdk 构建,但我遇到了不同的错误,我也需要处理这些错误。我在 Apple Mach O 链接器中遇到了 12 个错误:

Undefined symbols for architecture armv7:
"_iosLogin", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosLogout", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosInit", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosSetShareDialogMode", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFeedRequest", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosAppRequest", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBSettingsPublishInstall", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBAppEventsSetLimitEventUsage", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosGetDeepLink", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBAppEventsLogPurchase", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBAppEventsLogEvent", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

它会是什么?

最佳答案

“Undefined symbols for architecture armv7”的常见原因是:

您导入了标题但未链接到正确的库。这很常见,特别是对于像 QuartzCore 这样的库的头文件,因为默认情况下它不包含在项目中。解决:

在 Build Phases 的 Link Binary With Libraries 部分添加正确的库。

如果你想在默认搜索路径之外添加一个库,你可以在 Build Settings 的 Library Search Paths 值中包含该路径并添加-l{library_name_without_lib_and_suffix}(例如,对于 libz.a 使用 -lz)到build设置的其他链接器标志部分。

您将文件复制到您的项目中,但忘记检查要将文件添加到的目标。解决:

打开正确目标的构建阶段,展开编译源并添加缺少的 .m 文件。

您包含一个静态库,该库是为另一种架构构建的,例如 i386,您主机上的模拟器。解决:

如果您有多个来自库供应商的库文件要包含在项目中,您需要包含一个用于模拟器 (i386) 的文件和一个用于设备(​​例如 armv7)的文件。

您可以选择创建一个包含两种架构的胖静态库。

也试试这个

从所有静态库的项目build设置中删除 Build Active Architecture Only(build设置参数键为“ONLY_ACTIVE_ARCH”)或用“NO”覆盖它

关于ios - 尝试为 iPhone 模拟器构建 Unity 应用程序时出现 Apple Mach O 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25132515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com