Cocoapods <RestKit/RestKit.h> not found

I have a really hard time install RestKit into my project using CocoaPods. I get the not found error.

My Pods.xcconfig looks like this:

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/ISO8601DateFormatterValueTransformer" "${PODS_ROOT}/Headers/RKValueTransformers" "${PODS_ROOT}/Headers/RestKit" "${PODS_ROOT}/Headers/RestKit/CoreData" "${PODS_ROOT}/Headers/RestKit/Network" "${PODS_ROOT}/Headers/RestKit/ObjectMapping" "${PODS_ROOT}/Headers/RestKit/Support" "${PODS_ROOT}/Headers/SDWebImage" "${PODS_ROOT}/Headers/SOCKit" "${PODS_ROOT}/Headers/SSKeychain" "${PODS_ROOT}/Headers/SVProgressHUD" "${PODS_ROOT}/Headers/TTTAttributedLabel" "${PODS_ROOT}/Headers/TransitionKit" "${PODS_ROOT}/Headers/Vendor/LibComponentLogging/Core" "${PODS_ROOT}/Headers/Vendor/LibComponentLogging/NSLog" OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/AFNetworking" -isystem "${PODS_ROOT}/Headers/ISO8601DateFormatterValueTransformer" -isystem "${PODS_ROOT}/Headers/RKValueTransformers" -isystem "${PODS_ROOT}/Headers/RestKit" -isystem "${PODS_ROOT}/Headers/RestKit/CoreData" -isystem "${PODS_ROOT}/Headers/RestKit/Network" -isystem "${PODS_ROOT}/Headers/RestKit/ObjectMapping" -isystem "${PODS_ROOT}/Headers/RestKit/Support" -isystem "${PODS_ROOT}/Headers/SDWebImage" -isystem "${PODS_ROOT}/Headers/SOCKit" -isystem "${PODS_ROOT}/Headers/SSKeychain" -isystem "${PODS_ROOT}/Headers/SVProgressHUD" -isystem "${PODS_ROOT}/Headers/TTTAttributedLabel" -isystem "${PODS_ROOT}/Headers/TransitionKit" -isystem "${PODS_ROOT}/Headers/Vendor/LibComponentLogging/Core" -isystem "${PODS_ROOT}/Headers/Vendor/LibComponentLogging/NSLog" OTHER_LDFLAGS = -ObjC -framework CFNetwork -framework CoreData -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration PODS_ROOT = ${SRCROOT}/Pods

Podfile like so:

platform :ios, '7.0'

pod 'TTTAttributedLabel'

pod 'SVProgressHUD', :head

pod 'SDWebImage', '~>3.6'

pod 'SSKeychain'

pod 'RestKit', '0.23.1'

My Project settings in in the other linker flags includes:

$(inherited)

And the header search paths does also include:

$(inherited)
"$(BUILT_PRODUCTS_DIR)/../../Headers"

My target configuration is like so:

enter image description here

How can I fix this issue?

Upvotes: 5

Views: 845

Answers (1)

Shihab
Shihab

Reputation: 121

In my case this issue was related to pods configuration.

Step to resolve.

IMP: Backup your project before doing any configuration changes.

  1. Find the file where the variable PODS_ROOT is defined in your project. It will be defined under Pods-<Project Name>.debug.xcconfig and Pods-<Project Name>.release.xcconfigfiles.
  2. Reveal/Show both files in Finder , it will be under the folder /Pods/Target Support Files/Pods-<Project Name>/
  3. Delete both files from your project (DO NOT trash, only remove the reference)
  4. Now from your project navigator , open build-debug.xcconfig

Replace the following line ,

#include "../pods-debug.xcconfig"

with the following line,

#include "../Pods-<Your Project Name>.debug.xcconfig"

and in build-release.xcconfig replace the following line ,

#include "../pods-release.xcconfig"

with the following line,

#include "../Pods-<Your Project Name>.release.xcconfig"
  1. Replace the original file pods-debug.xcconfig and pods-release.xcconfig files under your project folder with the files Pods-<Your Project Name>.debug.xcconfig and Pods-<Your Project Name>.release.xcconfig respectively from the folder /Pods/Target Support Files/Pods-<Project Name>/.

  2. Add back the new configuration files Pods-<Your Project Name>.debug.xcconfig and Pods-<Your Project Name>.release.xcconfig to your project.

  3. Confirm both your project and target is referring to pods-debug.xcconfig/pods-release.xcconfig (Select Project File then select 'info' tab, under that expand 'Configurations')

  4. Confirm 'Build Settings/Header Search Paths' contains $(inherited)

  5. Reopen your project and do a clean build.

Explaining the issue

The pod configuration was not properly loaded to your project , to test this you can simply add "$(PODS_ROOT)/test" under 'Build Settings/Header Search Paths', you can see it is resolving to '/test' , that means the variable PODS_ROOT was not defined and hence it is resolving to empty string. That means the config file where PODS_ROOT is defined not loaded to project settings. Now check the config file set in your Xcode project (Select Project File then select 'info' tab, under that expand 'Configurations') it is referring to build.xcconfig and build-debug.xcconfig/build-release.xcconfig. These files includes the pod config files, but the included config files pods-debug.xcconfig/pods-release.xcconfig doesn't contain the required pod config details. So, now we replaced this with correct config file. You can also try copy paste the content of config files so that we can avoid replacing the files.

Upvotes: 0

Related Questions