Cocoapods <RestKit/RestKit.h> not found - ios

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:
How can I fix this issue?

In my case this issue was related to pods configuration.
Step to resolve.
IMP: Backup your project before doing any configuration changes.
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.
Reveal/Show both files in Finder , it will be under the folder /Pods/Target Support Files/Pods-<Project Name>/
Delete both files from your project (DO NOT trash, only remove the reference)
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"
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>/.
Add back the new configuration files Pods-<Your Project Name>.debug.xcconfig and Pods-<Your Project Name>.release.xcconfig to your project.
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')
Confirm 'Build Settings/Header Search Paths' contains $(inherited)
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.

Related

Tesseract "_OBJC_CLASS_$_G8Tesseract", referenced from:

<<< xcode linker error message >>>
"_OBJC_CLASS_$_G8Tesseract", referenced from:objc-class-ref in CalendarViewController.o
ld: symbol(s) not found for architecture x86_64
<<< import header file >>>
import "TesseractOCRiOS/TesseractOCR/TesseractOCR.h"
<<< podfile >>>
platform :ios, '9.0'
target 'toeicMap' do
pod 'TesseractOCRiOS', :git => 'https://github.com/gali8/Tesseract-OCR-iOS.git'
end
<<< pod install message >>>
hirata-MacBook-Pro:myMap+pod hirata$ pod install
Analyzing dependencies
Downloading dependencies
Installing TesseractOCRiOS 4.0.0 (was 3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] The toeicMap [Debug] target overrides the CLANG_CXX_LIBRARY build setting defined in Pods/Target Support Files/Pods-toeicMap/Pods-toeicMap.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
[!] The toeicMap [Release] target overrides the CLANG_CXX_LIBRARY build setting defined in Pods/Target Support Files/Pods-toeicMap/Pods-toeicMap.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
hirata-MacBook-Pro:myMap+pod hirata$
<<< Target Support Files/Pods-toeicMap/Pods-toeicMap.debug.xcconfig >>>
CLANG_CXX_LIBRARY = compiler-default
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/TesseractOCRiOS"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/TesseractOCRiOS" $(inherited) "${PODS_ROOT}/TesseractOCRiOS/TesseractOCR/lib"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/TesseractOCRiOS"
OTHER_LDFLAGS = $(inherited) -ObjC -weak_library /usr/lib/libstdc++.6.0.9.dylib -l"TesseractOCRiOS" -l"lept" -l"stdc++" -l"tesseract_all" -framework "Foundation" -framework "UIKit"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}/Pods
pod version = 1.0.1
Any help is appreciated!

XCode project not picking up CocoaPod configuration

I have a XCode project, Unity-iPhone which is configured with a Podfile,
platform :ios
target 'Unity-iPhone' do
pod 'GooglePlayGames', '~> 4.4'
end
target 'Unity-iPhone Tests' do
end
And everything about the Pods project adjacent to Unity-iPhone, and even the Unity-iPhone project seems to be set up correctly.
There's a sub-folder within Unity-iPhone called Pods, with the debug and release configuration files, with basically the same configuration,
FRAMEWORK_SEARCH_PATHS = "$(PODS_ROOT)/GooglePlayGames/gpg-cpp-sdk/ios" "$(PODS_ROOT)/google-plus-ios-sdk/google-plus-ios-sdk-1.7.1" "$(PODS_ROOT)/google-plus-ios-sdk/google-plus-ios-sdk-1.7.1"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/GooglePlayGames" "${PODS_ROOT}/Headers/Public/GooglePlayGames/gpg" "${PODS_ROOT}/Headers/Public/google-plus-ios-sdk" "${PODS_ROOT}/Headers/Public/google-plus-ios-sdk/GoogleOpenSource" "${PODS_ROOT}/Headers/Public/google-plus-ios-sdk/GooglePlus"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/GooglePlayGames" -isystem "${PODS_ROOT}/Headers/Public/GooglePlayGames/gpg" -isystem "${PODS_ROOT}/Headers/Public/google-plus-ios-sdk" -isystem "${PODS_ROOT}/Headers/Public/google-plus-ios-sdk/GoogleOpenSource" -isystem "${PODS_ROOT}/Headers/Public/google-plus-ios-sdk/GooglePlus"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "AddressBook" -framework "AssetsLibrary" -framework "CoreData" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreMotion" -framework "CoreTelephony" -framework "CoreText" -framework "Foundation" -framework "GoogleOpenSource" -framework "GooglePlus" -framework "MediaPlayer" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "gpg"
PODS_ROOT = ${SRCROOT}/Pods
Which, again, looks completely correct. These configurations are linked correctly from the project settings, but when I try to build, there's no reference to gpg at all (gpg is a binary file needed during linkage), and the build fails, with all references to declarations from there obviously failing.
If I manually edit the necessary frameworks in the build settings, and add gpg, the build works, so the frameworks path, and then before then, the headers path are all good. But that OTHER_LDFLAGS configuration from the pod configuration file is just ignored / never initially included.
If I'm honest, I'm not 100% sure any of the config file is actually work as I'm fairly unfamiliar with the exact way it all comes together.
Check if the error messages are originating in the "Unity-iPhone Tests" target. What could be happening is your source files are members of both build targets, and since the pod GooglePlayGames is only included in the primary target, your Tests target will complain because it can't compile your source without the dependencies the code is referring to.
One solution to this is to unmark the source files for the Tests target, and temporarily comment out your Tests-specific code. Now see if it can compile.
Later on, to get your Tests running again, you can mark certain source files as members of the Tests target, particularly code that either doesn't reference the dependencies, or code that abstracts your dependencies out completely so that the Tests target doesn't need to know about them at all. This way you can still share some code between the two targets directly and be able to test certain things that need testing.
The other, probably better, solution is to just unmark everything from Tests and add import Unity-iPhone to the top of your Tests's file. The "downside" to this is you have to then spend time adjusting the scoping of the code in your primary target (i.e. public vs internal vs private) to make sure that the classes and functions are visible to the Tests module. Be careful with this because how you alter the scoping here can have important implications if you're developing a family of applications that other developers will be working on, or if you're creating a library project that other developers will consume.
The gpg.framework is part of the GooglePlayGames Pod, so it is linked into libPod.a. The Unity-iPhone project links against the libPod, so that is how it finds the gpg lib.
You can see what is being included in the Pod by looking at Pods/GooglePlayGames.
What version(s) of the podspec are you picking up? If you look in Podfile.lock, it has some info. My project is working, here is my Podfile.lock contents:
PODS:
- google-plus-ios-sdk (1.7.1)
- GooglePlayGames (4.4.1):
- google-plus-ios-sdk (>= 1.5)
DEPENDENCIES:
- GooglePlayGames (~> 4.4)
SPEC CHECKSUMS:
google-plus-ios-sdk: 47adbe03ea904bdb7aa1c0eca282a23c4686e1bc
GooglePlayGames: 9102e31d4e04e7a642419fef9a4cf0814a128b7d
There also are some troubleshooting tips for Cocoapods: https://guides.cocoapods.org/using/troubleshooting.html

Cocoapods generate bad xcconfig file - no header search path

I'm facing with a problem, that all of the libraries are not found in the project, and I figured out that the Pods.debug.xcconfig file does not contains a header search path so probably that's the reason of this, but I don't know why and how can I solve this problem.
My podfile looks like this:
platform :ios, '8.0'
use_frameworks!
target 'Project' do
pod 'FBSDKCoreKit', '~> 4.2'
pod 'FBSDKLoginKit', '~> 4.2'
pod 'JSONHelper', '~> 1.6'
end
and the xcconfig file is this:
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '#executable_path/Frameworks' '#loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/Bolts.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/FBSDKCoreKit.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/FBSDKLoginKit.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/JSONHelper.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "Bolts" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "JSONHelper"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Project
PODS_ROOT = ${SRCROOT}/Pods
I'm using Xcode 6.3.2 and swift.
Figured out that to problem caused by this line: use_frameworks!
because I wanted to include JSONHelper which is written in swift.
Removing this and added the JSONHelper by hand solved the problem.

use_frameworks! Cocoapods, can't find header file for non-cocoapods framework

I am using Cocoapods in my project, but I also want to use frameworks that are not managed by Cocoapods. I recently tried to switch to frameworks using the use_frameworks! command in my podfile, but the result is that the build fails because it can't find a header from my third-party framework. In the xcconfig file for my project, I have FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/vendor, which worked in the past (vendor being where the .framework file is stored).
I don't know much about this topic; my attempt at solving this was to add a HEADER_SEARCH_PATHS setting to the xcconfig file with the same settings as the FRAMEWORK_SEARCH_PATHS, which did not solve the problem. Any help would be appreciated.
EDIT: upon further investigation into the problem I think I better understand what is causing this behavior, though I'm no closer to a resolution. The Xcconfig configuration I'm using is set up approximately like this for the debug scheme:
Pods-ProjectName.debug.xcconfig -- the CocoaPods created xcconfig file for the project. Contents are roughly as follows:
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '#executable_path/Frameworks' '#loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/x.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/y.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/z.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/a.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "x" -framework "y" -framework "z" -framework "a"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-ProjectName
PODS_ROOT = ${SRCROOT}/Pods
ProjectName.xcconfig - contents are as follows:
APPLICATION_EXTENSION_API_ONLY = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/vendor
WARNING_CFLAGS = $(inherited) -include "$(SOURCE_ROOT)/ProjectName/ProjectNameVersion.h"
INFOPLIST_FILE = ProjectName/Info.plist
PRODUCT_NAME = ProjectName
SKIP_INSTALL = YES
ProjectNameDebug.xcconfig - includes both of the prior xcconfig files, is the project's xcconfig file. In case it matters, here's the contents:
#include "ProjectName.xcconfig"
<h1>include "../Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig"
The thing is, what I'm actually seeing when I open the xcporoject file and go to Build Settings->Framework Search Paths is bulid/Debug-iphoneos/Pods-ProjectName. So somehow my vendor search path is getting overwritten.
Apologies for the formatting, SO didn't want to highlight this stuff as code, and in some cases even tried to make it bold...

CocoaPods generates invalid project file (header not found)

I have a project file with a Podfile that looks like this:
platform :ios, '7.0'
def import_pods
pod 'Specta', '0.1.8'
pod 'Expecta', '0.2.1'
pod 'RestKit', '0.20.3'
pod 'MagicalRecord', '2.1'
pod 'RestKit/Testing', '0.20.3'
end
link_with 'LocalMedTests'
import_pods
When I run pod install, it generates the Podfile.lock, Pods directory, and workspace for my project. When I open the workspace to build it, I get errors like this: 'RestKit.h' file not found.
It seems to only be an issue for RestKit but I can't get past those errors to see if there are more. The restkit headers are in Pods/Headers. They're properly included in Pods.xcconfig. Here it is for good measure:
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/Expecta" "${PODS_ROOT}/Headers/MagicalRecord" "${PODS_ROOT}/Headers/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit/CoreData" "${PODS_ROOT}/Headers/RestKit/RestKit/Network" "${PODS_ROOT}/Headers/RestKit/RestKit/ObjectMapping" "${PODS_ROOT}/Headers/RestKit/RestKit/Support" "${PODS_ROOT}/Headers/RestKit/RestKit/Testing" "${PODS_ROOT}/Headers/SOCKit" "${PODS_ROOT}/Headers/Specta" "${PODS_ROOT}/Headers/TransitionKit"
OTHER_LDFLAGS = -ObjC -framework CFNetwork -framework CoreData -framework Foundation -framework MobileCoreServices -framework Security -framework SenTestingKit -framework SystemConfiguration
PODS_ROOT = ${SRCROOT}/Pods
I've tried cleaning and cleaning the build folder. It doesn't matter - I always get the header not found error.
I should also add that all of the header directories specified by Pods.xcconfig are included in the target as they should be.
Any ideas about this? I've been using CocoaPods in this project for a couple of months with no issue, did something change recently?
This solved my Problem
In HEADER_SEARCH_PATHS Under your Project Build Setting add the $(inherited)
Also DO this for all TAGETS
Change Arcgitectures to Standard armv7
https://stackoverflow.com/a/12142790/1294448
For me, the problem was with Other Linker Flags and Runpath Search Paths, which weren't inheriting the settings defined on xcconfig. The following adjustments solved my problem:
Other Linker Flags:
$(inherited)
Runpath Search Paths:
$(inherited)
#executable_path/Frameworks

Resources