Apple Mach O Linker错误试图为iPhone模拟器构建Unity应用程序

时间:2014-08-05 06:34:21

标签: ios xcode ios-simulator chartboost

所以我有这个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构建,并且我还需要处理不同的错误。我有12个Apple Mach O连接器的错误:

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)

它可能是什么?

1 个答案:

答案 0 :(得分:1)

"架构armv7的未定义符号的常见原因"是:

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

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

如果要在默认搜索路径之外添加库,可以在“构建设置”的“库搜索路径”值中包含该路径并添加 -l {library_name_without_lib_and_suffix}(例如,对于libz.a使用-lz)到Build Settings的Other Linker Flags部分。

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

打开正确目标的Build Phases,展开Compile Sources并添加缺少的.m文件。

您包含一个为另一个体系结构构建的静态库,例如主机上的模拟器i386。要解决:

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

或者,您可以创建一个包含两种体系结构的胖静态库。

也试试这个

从所有静态库中删除Build Build Active Architecture(构建设置参数键为' ONLY_ACTIVE_ARCH')'项目构建设置或用' NO'

覆盖它