RKObjectMapping.h Not Found

最后都变了- 提交于 2020-01-10 06:52:42

问题


I "pod update", and my RestKit version now is 0.25.0, my RKValueTransformers is 1.1.2, and an error appeared "RKObjectMapping.h" not found.

What did RestKit change in the new version, that I check on the its github cannot find anything.

The following steps can reproduce the error:

1) Create a new project

2) pod init

Podfile looks like:

platform :ios, '8.3'
#pod 'RestKit', '~> 0.20.0'
#pod 'RestKit', '~> 0.24.1'
pod 'RestKit'

In all cases of different versions, the issue is the same

3) open .xcworkspace

4) in the viewcontroller.m

#import <RestKit/ObjectMapping/RKObjectMapping.h>
#import <RestKit/ObjectMapping/RKRelationshipMapping.h>
#import <RestKit/Network/RKResponseDescriptor.h>
#import <RestKit/Network/RKObjectRequestOperation.h>
#import <RestKit/Support/RKLog.h>
#import <RestKit/CoreData/RKEntityMapping.h>
#import <RestKit/Network/RKObjectManager.h>

or

#import "RKObjectMapping.h"
#import "RKRelationshipMapping.h"
#import "RKResponseDescriptor.h"
#import "RKObjectRequestOperation.h"
#import "RKLog.h"
#import "RKEntityMapping.h"
#import "RKObjectManager.h"

The error is still there: "RKObjectMapping.h" not found in a file of RestKit Pod

Note: I am using Xcode 7-beta5, Objective-C


回答1:


There is easy way to work around this problem when you don't want to touch cocoapods. because fixing them itself a hassle. I have fixed my problem as follows:

Click on your project file
Then go to build settings search for "header search path"
With the drop down just make them recursive.

You Should be looking for following:

${PODS_ROOT}/Headers/Public/AFNetworking
${PODS_ROOT}/Headers/Public/Bolts
${PODS_ROOT}/Headers/Public/ISO8601DateFormatterValueTransformer
${PODS_ROOT}/Headers/Public/RKValueTransformers
${PODS_ROOT}/Headers/Public/RestKit 
${PODS_ROOT}/Headers/Public/SOCKit
${PODS_ROOT}/Headers/Public



回答2:


After a while struggling, I noticed the error is not from RestKit. It comes from upgrading the latest version of cocoapods (0.39.beta.4).

The Header Search Path is not in recursive mode anymore.

The workaround is just downgrade the version of cocoapods to 0.38.0.

1) remove the latest version of cocoapod

sudo gem uninstall cocoapods

2) install the 0.38.0 version

sudo gem install cocoapods -v 0.38.0

Hope can help someone.

Updated:

Thanks Vig that we can do pod with a specific version:

pod _0.38.0_ update
pod _0.38.0_ install



回答3:


This has finally been fixed in the development branch of RestKit with the final patch being in 1d8f3e332, I think.

Hopefully it will be merged into master soon.

For now, if you're feeling brave, you can use

pod 'RestKit', :git => 'git@github.com:RestKit/RestKit.git', :commit => '1d8f3e3325d959094a3f96c832bf9f54c9c48df3'



回答4:


I solved this by building pods as frameworks.

use_frameworks!


来源:https://stackoverflow.com/questions/32562446/rkobjectmapping-h-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!