简体   繁体   English

RestKit和CocoaPods的Xcode 7链接器错误

[英]Xcode 7 linker error with RestKit and CocoaPods

I just upgraded to Xcode 7 and CocoaPods 0.38.2 and, after resolving some Swift 2 issues, got the following linker error with my mixed Objective-C & Swift project targeting iOS 7: 我刚刚升级到Xcode 7和CocoaPods 0.38.2,在解决了一些Swift 2问题之后,针对iOS 7的我的Objective-C和Swift混合项目出现了以下链接器错误:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RKManagedObjectRequestOperation", referenced from:
      objc-class-ref in NetworkHelper.o
  "_OBJC_CLASS_$_RKManagedObjectResponseMapperOperation", referenced from:
      type metadata accessor for ObjectiveC.RKManagedObjectResponseMapperOperation in MappingHelper.o
  "_RKLogCoreDataError", referenced from:
      ___33-[RKEntityByAttributeCache load:]_block_invoke in libRestKit.a(RKEntityByAttributeCache.o)
      ___43-[RKManagedObjectImporter finishImporting:]_block_invoke in libRestKit.a(RKManagedObjectImporter.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

CoreData is included in my .pch file and is included before RestKit in the bridging header, and Bitcode is off. CoreData包含在我的.pch文件中,并且包含在桥接头中的RestKit之前,并且Bitcode已关闭。 I'm using RestKit 0.24.1. 我正在使用RestKit 0.24.1。

Since it appears that RestKit isn't detecting the presence of the CoreData framework and its conditional declarations are accordingly getting passed over, I've tried lots of various ways to tell my app or the RestKit pod about the presence of Core Data, but nothing seems to help. 既然RestKit似乎没有检测到CoreData框架的存在,并且它的条件声明也相应地被传递了,所以我尝试了多种方法来告诉我的应用程序或RestKit pod有关Core Data的存在,但是什么也没有似乎有帮助。

I resolved this issue by following these steps: 我按照以下步骤解决了这个问题:

  1. Upgrade my cocoapods (0.39.0) 升级我的cocoapods(0.39.0)
  2. Goto build settings of my target and search for header search paths. 转到构建目标的设置并搜索标题搜索路径。
  3. Make all header search paths recursive (This is important) I also tried by my making recursive only to restkit but for some reason i don't know it does not work. 使所有标头搜索路径都是递归的(这很重要)我也尝试过仅对restkit进行递归,但是由于某种原因,我不知道它不起作用。
  4. Then disable the bitcode. 然后禁用位码。
  5. Finally build. 最终建立。

参考屏幕截图

For more information see this link 有关更多信息, 请参见此链接

Upgrading from an older version of RestKit (0.23.3) to 0.25.0 worked for me. 从较早版本的RestKit (0.23.3)升级到0.25.0对我来说很有效。

I also upgraded Xcode to 7.0.1, deleted xcworkspace, and reran pod install for good measure. 我也将Xcode升级到7.0.1,删除了xcworkspace,并重新运行了pod install以取得良好的效果。

upgrade you cocoapods and xcode7.0.1 升级您的cocoapods和xcode7.0.1

and remove xcworkspace and pod install again. 并删除xcworkspace和pod再次安装。

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

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