简体   繁体   English

CocoaPods Swift链接器错误

[英]CocoaPods Swift Linker Error

I am trying to use the Loggly libraries through Lumberjack in an iOS application written in Swift. 我试图通过Lumberjack在以Swift编写的iOS应用程序中使用Loggly库。 I am getting the following linker errors: 我收到以下链接器错误:

undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_LogglyFormatter", referenced from:
  __TMaCSo15LogglyFormatter in AppDelegate.o
"_OBJC_CLASS_$_LogglyLogger", referenced from:
  __TMaCSo12LogglyLogger in AppDelegate.o
ld: symbol(s) not found for architecture x86_64

I have it using a bridging header for some other libraries (not pod ones) that work just fine. 我使用桥接头为其他一些可以正常工作的库(而不是pod的库)使用。

Here is the contents of my bridging header: 这是我的桥接标头的内容:

#import <AFNetworking/AFNetworking.h>
#import <CocoaLumberjack/DDLog.h>
#import <LogglyLogger-CocoaLumberjack/LogglyLogger.h>
#import <LogglyLogger-CocoaLumberjack/LogglyFormatter.h>

Lastly here is the contents of my Podfile: 最后是我的Podfile的内容:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'CocoaLumberjack'
pod 'AFNetworking'
pod 'LogglyLogger-CocoaLumberjack', :git => 'https://github.com/melke/LogglyLogger-CocoaLumberjack'

Anybody have a suggestion on this? 有人对此有建议吗?

As of Cocoapods 0.25.0 the Xcode configuration maintains that the Pods are built with build setting ONLY_ACTIVE_ARCH set to YES. 从Cocoapods 0.25.0开始,Xcode配置保持Pods的构建设置为ONLY_ACTIVE_ARCH设置为YES。 You have two options: 您有两种选择:

  1. Make sure you set "Build Active Architecture" to YES for your Debug configuration 确保将Debug配置的“ Build Active Architecture”设置为“ YES”
  2. Set Build Active Architecture to NO for the cocoapods in the Debug configuration 在调试配置中将cocoapods的Build Active Architecture设置为NO。

So assuming you did option 1, navigate to your build settings and you should end up with something like this: 因此,假设您已执行选项1,请导航至构建设置,然后您应该得到如下所示的内容:

在此处输入图片说明

Included from the official Troubleshooting Guide 包含在官方《 故障排除指南》中

This applies to users migrating projects from Xcode 4, or are still using Xcode 4. 这适用于从Xcode 4迁移项目或仍在使用Xcode 4的用户。

  1. The Pods Xcode project now sets the ONLY_ACTIVE_ARCH build setting to YES in the Debug configuration. Pods Xcode项目现在在Debug配置中将ONLY_ACTIVE_ARCH构建设置设置为YES。 You will have to set the same on your project/target, otherwise the build will fail. 您将必须在项目/目标上设置相同的设置,否则构建将失败。

  2. Ensure your project/target has an ARCHS value set, otherwise the build will fail. 确保您的项目/目标设置了ARCHS值,否则构建将失败。

  3. When building a iOS project from the command-line, with the xcodebuild tool that comes with Xcode 4, you'll need to completely disable this setting by appending to your build command: ONLY_ACTIVE_ARCH=NO. 使用Xcode 4随附的xcodebuild工具从命令行构建iOS项目时,您需要通过附加到构建命令ONLY_ACTIVE_ARCH = NO来完全禁用此设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM