Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fail to find header file when using Cocoapods version 1.0 - works fine with Cocoapods version 0.39

I'm trying to use libFLAC compiled to iOS in my project, using CocoaPod to install as a dependancy.

The trouble is the workspace is created just fine if I use CocoaPod version 0.39 but there is a build error if I use CocoaPod version 1.0 (see below for details about the error)

I'm using the project https://github.com/evature/flac-ios

My podfile contains:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/evature/Eva-Pods.git'

platform :ios, '8.0'

use_frameworks!
target 'ExampleApp' do
    pod 'JSQMessagesViewController', '~>7.0'
    pod 'libFLAC', '~>1.3.0'
    pod 'RXPromise', '~>0.13.0'
end

The compile error is of a missing header file (inside the libFlac source) -

#include "private/bitmath.h" << 'private/bitmath.h' not found

This header file does exist in the Pods project under Pods/libFlac/CorePrivateHeaders

The libFlac podspec is at https://github.com/evature/Eva-Pods/blob/master/libFLAC/1.3.1/libFLAC.podspec

I'm using Xcode Version 7.3.1

I guess the blame is some breaking change between version 0.39 and version 1.0, but looking at the changelog and the Podspec I failed to find the breaking change.

like image 855
Iftah Avatar asked May 15 '16 11:05

Iftah


People also ask

Why are my Pod header files not working?

Check if the pod header files are correctly symlinked in Pods/Headers and you are not overriding the HEADER_SEARCH_PATHS (see #1). Make sure your project is using the Pods.xcconfig.

Why can’t Xcode find the headers of the dependencies?

If Xcode can’t find the headers of the dependencies: Check if the pod header files are correctly symlinked in Pods/Headers and you are not overriding the HEADER_SEARCH_PATHS (see #1). Make sure your project is using the Pods.xcconfig.

Why are my headers not being imported?

If the headers aren't being imported, you probably have a conflict in the HEADER_SEARCH_PATHS. Try and add $ (inherited) to the header search paths in your Build Settings to make sure that it pulls in any search paths included in the .xcconfig file from your CocoaPods.

Why can't I find the headers in my project?

The Project->Info->Configurations in the Xcode project (your project) should be set to 'Pods' for Debug, Release (and whatelse you have). See "Headers not found – search paths not included" Maybe you have to link the target with the link_with command. See "Unable to find headers in Static Library project"


2 Answers

Did a quick test. I think you have to remove the "use_frameworks!" line from your podfile. Since none of the other libraries are built using Swift you should be fine.

like image 73
Jon Vogel Avatar answered Oct 20 '22 09:10

Jon Vogel


For me, it's caused by Xcode cache data. You can copy your project to a new file path and run to test this. Or delete the cache and run. This is how to delete:

  1. Open Xcode Preference and select Locations: enter image description here

  2. Click arrow to Derived Data, and delete all files in DeriveData folder: enter image description here

  3. Run.
like image 30
Lumialxk Avatar answered Oct 20 '22 08:10

Lumialxk