在 xcode 8.2.1 中的 obj-c 项目中使用 (ios-charts) 框架导致苹果 mach-o 链接器错误

Using (ios-charts) framework in obj-c project in xcode 8.2.1 cuasing apple mach-o linker error

我正在使用

danielgindi/Charts

我的 obj-c 项目中的框架版本:3.0.1。

所有其他框架都在 swift 中(如 AFNetworking ),但在这个框架中我得到一些错误,如:

error: /Users/pooya/Library/Developer/Xcode/DerivedData/MY-Project/Build/Products/Debug-iphoneos/Charts.framework: No such file or directory

当我尝试在我的 iPhone 7 上构建时,会发生此错误!

但是当我尝试在某些 64 位模拟器(如 iPhone 6s)上 运行 它时,我收到此错误:

ignoring file /Users/pooya/Library/Developer/Xcode/DerivedData/ZF_Vendor-cgqfmefljmubdqfloevghfslaasp/Build/Products/Debug-iphonesimulator/Charts.framework/Charts, file was built for i386 which is not the architecture being linked (x86_64): /Users/pooya/Library/Developer/Xcode/DerivedData/MyProject/Build/Products/Debug-iphonesimulator/Charts.framework/Charts
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$__TtC6Charts12BarChartData", referenced from:
      objc-class-ref in ChartsViewController.o
  "_OBJC_CLASS_$__TtC6Charts15BarChartDataSet", referenced from:
      objc-class-ref in ChartsViewController.o
  "_OBJC_CLASS_$__TtC6Charts17BarChartDataEntry", referenced from:
      objc-class-ref in ChartsViewController.o
  "_OBJC_CLASS_$_ChartDefaultValueFormatter", referenced from:
      objc-class-ref in ChartsViewController.o
  "_OBJC_CLASS_$_ChartDefaultAxisValueFormatter", referenced from:
      objc-class-ref in ChartsViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

但在 iPhone 5 和其他 32 位模拟器中它工作正常:|

找了三天没找到好的帮助!

我用这个配置通过 cocapods 添加了这个框架:

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '3.0'
      end
   end
  end

问题是 Xcode 赶上了!

此框架有一个默认构建(即 i386 ),构建后 Xcode 捕获它以开发文件!

尝试通过 command + option + shift + k 清理 :)

对于 Xcode 中 pods 中的图表,不要忘记将架构 SDK 设置为 iOS!

无需向您的目标添加二进制框架(如 github 中所写)