使用Xcode 6时,使用cocoapods AFNetworking链接错误

问题描述 投票:2回答:2

将项目从Xcode 5迁移到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

我选择cocoapods作为包管理器,项目结构如下:

主要项目和BaseLib都在使用一些pod,同时项目使用BaseLib.a。

我尝试使用Xcode 5和iOS 7.1 SDK(这是唯一的工作),Xcode 6和iOS 7.1 SDK以及Xcode 6和iOS 8.0 SDK。我目前的结论是,无论何时涉及Xcode 6,链接都将失败,无论我选择哪个版本的iOS SDK。

相关设置如下所述。

在项目和BaseLib上正确设置了xcconfig文件:

架构设置:

我的Podfile内容:

#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
ios xcode6 linker-errors cocoapods afnetworking-2
2个回答
0
投票

我希望你现在已经找到了解决方案。如果没有更新到AFNetworking 2.4解决了这个问题


0
投票

将“pod”文件安装到我的项目后,我遇到了这种类型的问题。我使用下面的代码解决了这个问题。

[!] 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.

将“Other Linker Flags”更改为$(继承)并解决我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.