简体   繁体   中英

CocoaPods Swift Linker Error

I am trying to use the Loggly libraries through Lumberjack in an iOS application written in Swift. 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.

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:

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. You have two options:

  1. Make sure you set "Build Active Architecture" to YES for your Debug configuration
  2. Set Build Active Architecture to NO for the cocoapods in the Debug configuration

So assuming you did option 1, navigate to your build settings and you should end up with something like this:

在此处输入图片说明

Included from the official Troubleshooting Guide

This applies to users migrating projects from Xcode 4, or are still using Xcode 4.

  1. The Pods Xcode project now sets the ONLY_ACTIVE_ARCH build setting to YES in the Debug configuration. 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.

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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