ios Xcode 8:找不到用于 pod 的架构 arm64 的符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39871595/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:28:59  来源:igfitidea点击:

Xcode 8: Symbol(s) not found for architecture arm64 for pods

iosxcodecocoapodslinker-errorsxcode8

提问by damjandd

After updating to Xcode 8, the app won't run on devices, only on the simulator. The errors are thrown for all pods added to the project:

更新到 Xcode 8 后,该应用程序将无法在设备上运行,只能在模拟器上运行。添加到项目中的所有 pod 都会抛出错误:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_AFNetworkReachabilityManager", referenced from:
      objc-class-ref in FeedViewController.o
  "_OBJC_CLASS_$_TSMessage", referenced from:
      l_OBJC_$_CATEGORY_TSMessage_$_Override in NotificationMessenger.o
      objc-class-ref in NotificationMessenger.o
  "_OBJC_CLASS_$_AFHTTPRequestSerializer", referenced from:
      objc-class-ref in HTTPSessionTask.o
  "_OBJC_CLASS_$_AFJSONRequestSerializer", referenced from:
      objc-class-ref in HTTPSessionTask.o
  "_OBJC_METACLASS_$_SWTableViewCell", referenced from:
      _OBJC_METACLASS_$_MessagesCell in MessagesCell.o
      _OBJC_METACLASS_$_PaymentMethodCell in PaymentMethodCell.o
      _OBJC_METACLASS_$_SwipeTitleCell in SwipeTitleCell.o
  "_OBJC_CLASS_$_FBRequestConnection", referenced from:
      objc-class-ref in FacebookManager.o
  "_OBJC_CLASS_$_SWTableViewCell", referenced from:
      _OBJC_CLASS_$_MessagesCell in MessagesCell.o
      _OBJC_CLASS_$_PaymentMethodCell in PaymentMethodCell.o
      _OBJC_CLASS_$_SwipeTitleCell in SwipeTitleCell.o
  "_OBJC_CLASS_$_FBRequest", referenced from:
      objc-class-ref in FacebookManager.o
  "_OBJC_CLASS_$_AFURLSessionManager", referenced from:
      objc-class-ref in HTTPSessionTask.o
  "_OBJC_CLASS_$_Branch", referenced from:
      objc-class-ref in MyImpactViewController.o
      objc-class-ref in UINavigationController+Activity.o
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FBSession", referenced from:
      objc-class-ref in FacebookManager.o
      objc-class-ref in ExternalFacebookCommand.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

For each of the files, this warning is also thrown:

对于每个文件,还会抛出此警告:

file was built for archive which is not the architecture being linked (arm64)

Active architectures are OK, I've tried deleting derived data folder, reinstalling the pods, setting Build Active Architectures Only to YES and NO, but nothing works.

活动架构没问题,我尝试删除派生数据文件夹,重新安装 pod,将仅构建活动架构设置为是和否,但没有任何效果。

My Podfile looks like this:

我的 Podfile 看起来像这样:

platform :ios, '8.0'
workspace 'Purple'
target 'Purple' do
pod 'AFNetworking', '2.6.3'
pod 'SAMKeychain', '~> 1.3'
pod 'TSMessages'
pod 'Facebook-iOS-SDK', '~> 3.23.2'
pod 'SWTableViewCell'
pod 'CardIO'
pod 'Parse'
pod 'PureLayout'
pod 'Branch'
pod 'DZNEmptyDataSet'
end

回答by Marku

Try clear the XCode caches:

尝试清除 XCode 缓存:

rm -rf ~/Library/Developer/Xcode/DerivedData/

Clear the CocoaPods caches and reinstall the dependencies:

清除 CocoaPods 缓存并重新安装依赖项:

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

Finally go to the "Pods" project and set the Build Active Architectures Only to No also for the "Debug" configuration.

最后转到“Pods”项目并将“仅构建活动架构”设置为“否”,也用于“调试”配置。

Reference https://stackoverflow.com/a/37930840/1773009

参考 https://stackoverflow.com/a/37930840/1773009

回答by Mohsen mokhtari

"The OPN [Debug] target overrides the OTHER_LDFLAGS build setting". This was the main issue. After adding $(inherited) in new line in other linker flags solved my issue.

“OPN [Debug] 目标覆盖 OTHER_LDFLAGS 构建设置”。这是主要问题。在其他链接器标志的新行中添加 $(inherited) 解决了我的问题。

enter image description here

在此处输入图片说明

回答by Mehul

Please use below pod code.

请使用以下 pod 代码。

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘9.0'
use_frameworks!

target “NoteCheck” do

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => ‘4.0.1'
    pod 'AlamofireNetworkActivityIndicator',    '~> 2.0'
    pod 'AlamofireObjectMapper',        '~> 4.0.0'
    pod 'UIActivityIndicator-for-SDWebImage',   '~> 1.2'
    pod 'SVProgressHUD'         ,:git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
    pod 'Reachability',             '~> 3.2'
    pod 'SwiftyJSON',               '~> 3.0.0'
    pod 'ObjectMapper' ,            '~> 2.0'
    pod 'SDWebImage',               '~> 3.8'

    pod 'SZTextView',               '~> 1.2'
    pod 'TPKeyboardAvoiding',           '~> 1.3'
    pod 'FXBlurView' ,              '~> 1.6.4'
    pod 'AMSmoothAlert',            '~> 1.0'

    pod 'DGElasticPullToRefresh',       '~> 1.1'
end

//Some of the cocoapod library support minimum IO9.0 Support. So try min deployment target to 9.0 and check all cocoapod swift3.0 supported library. after editing pod file, update pod.

//部分cocoapod库支持最低IO9.0 Support。所以尝试将最小部署目标设置为 9.0 并检查所有 cocoapod swift3.0 支持的库。编辑pod文件后,更新pod。