简体   繁体   中英

AFNetworking with cocoapods link error when using Xcode 6

I got an error when migrating my project from Xcode 5 to 6.

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_AFHTTPRequestOperationManager", referenced from:
      objc-class-ref in QCRoomListControllerViewController.o
      objc-class-ref in libQCBase.a(QCHttpRequestAdapter.o)
      objc-class-ref in libQCBase.a(QCHttpApi.o)
  "_OBJC_CLASS_$_AFHTTPResponseSerializer", referenced from:
      objc-class-ref in QCRoomListControllerViewController.o
  "_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
      objc-class-ref in libQCBase.a(QCHttpApi.o)
ld: symbol(s) not found for architecture i386

I choose cocoapods as package manager, and the project structure is like below: 在此处输入图片说明

both major project and BaseLib are using some pods, at the same time project is using BaseLib.a.

I've try combinations like Xcode 5 with iOS 7.1 SDK(which is the only working one), Xcode 6 with iOS 7.1 SDK and Xcode 6 with iOS 8.0 SDK. My current conclusion is whenever Xcode 6 is involved, links will fail, no matter which version of iOS SDK I choosed.

Relevant settings are described below.

The xcconfig file are correctly set on both project and BaseLib: 在此处输入图片说明

Architectures setting: 在此处输入图片说明

My Podfile content:

#platform :ios, "6.0"
source 'https://github.com/CocoaPods/Specs.git'

workspace 'QiChengWS.xcworkspace'
xcodeproj 'QiChengNew/QiChengNew.xcodeproj'
xcodeproj 'QCBase/QCBase.xcodeproj'


target :QiChengNew do
    pod 'JSONModel'
    pod 'SDWebImage', '~>3.6'
    pod 'AutoNSCoding', '~> 0.1.3'

    platform :ios, '7.0'

    pod 'ProtocolBuffers', '~> 1.9'
    pod 'CocoaAsyncSocket', '~> 7.3'

    pod 'GBInfiniteScrollView', '~> 1.6'
    pod 'GBInfiniteScrollView/PageControl'

    pod 'UMengAnalytics', '~> 3.1.2'

    platform :ios, '7'
    pod 'MWPhotoBrowser', '1.4.0'

    xcodeproj 'QiChengNew/QiChengNew.xcodeproj'
end


target :QCBase do
    platform :ios, '7.0'
    pod "AFNetworking", "~> 2.0"

    pod 'SVPullToRefresh', :head

    pod 'Toast', '~> 2.3'

    xcodeproj 'QCBase/QCBase.xcodeproj'
end

I hope you have found the solution by now. If not updating to AFNetworking 2.4 solved this for me

I have face this type of issue after installing 'pod' file to my project. I resolve this problem by using below code.

[!] The `sftest [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-sftest/Pods-sftest.debug.xcconfig'. This can lead to problems with the CocoaPods installation

- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

Change "Other Linker Flags" to $(inherited) and it solve my problem.

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