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.
Related
<<< 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!
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...
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.
I'm having troubles setting up OCMockito (and OCHamcrest) with Cocoapods on Xcode 5. This is my Podfile:
platform :ios, '5.0'
pod 'RestKit', '~> 0.20.0'
pod 'OCMockito', '~> 1.0.0'
link_with ['WeatherApp', 'WeatherAppTests']
When I try to follow iOS Project Setup (https://github.com/jonreid/OCMockito#adding-ocmockito-to-your-project), Xcode can't find this imports:
#define HC_SHORTHAND
#import <OCHamcrestIOS/OCHamcrestIOS.h>
#define MOCKITO_SHORTHAND
#import <OCMockitoIOS/OCMockitoIOS.h>
So I tried to do this insted:
#define HC_SHORTHAND
#import <OCHamcrest/OCHamcrest.h>
#define MOCKITO_SHORTHAND
#import <OCMockito/OCMockito.h>
It's working, but I don't know if that's fine.
Also, I have another question. As far as I understand, I'm linking RestKit and OCMockito to both my main target and my test target. Is it possible to link RestKit on both targets but link OCMockito only to the test target?
Thanks in advance for the help.
UPDATE:
This is the Pods.xcconfig generetad by Cocoapods:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/OCHamcrest" "${PODS_ROOT}/Headers/OCMockito" "${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/SOCKit" "${PODS_ROOT}/Headers/TransitionKit"
OTHER_LDFLAGS = -ObjC -framework CFNetwork -framework CoreData -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration
PODS_ROOT = ${SRCROOT}/Pods
It seems that the IOS headers aren't setup correctly, is the pod wrong then?
UPDATE:
This are the contents of Pods/Headers/OCMockito
OCHamcrestIOS applies only to using the prebuilt iOS framework. When using CocoaPods, just import OCHamcrest.
To use OCHamcrest (or OCMockito) in your test target bundle and not your main app you can add something like this to the Podfile:
target :YourTestTarget, :exclusive => true do
pod 'OCHamcrest', '~> 3.0'
pod 'OCMockito', '~> 1.0'
#pod 'RestKit/Testing'
end
If you plan to unit test your RestKit mapping (etc) then you may want to include RestKit/Testing in your bundle also.
Then you'd just include it like this:
#define HC_SHORTHAND
#import <OCHamcrest/OCHamcrest.h>
#define MOCKITO_SHORTHAND
#import <OCMockito/OCMockito.h>
This is what your complete Podfile might look like:
platform :ios, '5.1'
pod 'Appirater', '~> 0.0.2'
pod 'FlurrySDK', '~> 4.0.5'
pod 'RestKit', '~> 0.21.0'
target :FooBarTests, :exclusive => true do
#pod 'RestKit/Testing'
pod 'OCHamcrest', '~> 3.0'
pod 'OCMockito', '~> 1.0'
end
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