使用Xcode6时使用cocoapods连接连接错误

时间:2022-06-15 20:52:38

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

当我将项目从Xcode5迁移到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: 使用Xcode6时使用cocoapods连接连接错误

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

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

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

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

我尝试过将Xcode5与ios7.1 SDK(唯一可用的SDK)、Xcode6与ios7.1 SDK结合,Xcode6与ios8.0 SDK结合。我现在的结论是,只要Xcode6参与,链接就会失败,不管我选择的是哪个版本的iOS SDK。

I've been searching a fair solution for almost 3 days, cocoapods issues and everything. Relevant settings are described below, any idea or further information would be appreciated:)

我花了近3天时间寻找一个公平的解决方案,关于可可豆的问题等等。相关的设置如下,如有任何想法或进一步的信息,将不胜感激。)

The xcconfig file are correctly set on both project and BaseLib: 使用Xcode6时使用cocoapods连接连接错误

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

Architectures setting: 使用Xcode6时使用cocoapods连接连接错误

架构设置:

My Podfile content:

我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

2 个解决方案

#1


0  

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

我希望你现在已经找到解决办法了。如果不更新到AFNetworking 2.4,我就解决了这个问题

#2


0  

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

在我的项目中安装了“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.

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

将“其他链接器标志”更改为$(继承),就可以解决我的问题。

#1


0  

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

我希望你现在已经找到解决办法了。如果不更新到AFNetworking 2.4,我就解决了这个问题

#2


0  

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

在我的项目中安装了“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.

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

将“其他链接器标志”更改为$(继承),就可以解决我的问题。