Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods 1.0: Header files not found

I just tried to update from cocoapods 0.39.x to Cocoapods 1.0. Running

pod install

from the terminal causes no warnings. Everything seems normal. However, when I try to build my project it outputs:

AFNetworking/AFNetworking.h file not found

My pod file looks like this (there are a few more dependencies but I only listed a part of it):

platform :ios, '8.0' use_frameworks! source 'https://github.com/CocoaPods/Specs.git'  target 'MyApp' do     pod 'AFNetworking', '~> 2.6'     pod 'BEMCheckBox'     pod 'ActionSheetPicker-3.0', '~> 2.0.5'     pod 'SCLAlertView'     pod 'DZNEmptyDataSet'     pod 'SSZipArchive' end   target 'MyAppTests' do  end 

Since some projects are written in Objective-C, i created a bridging header:

#import <AFNetworking/AFNetworking.h> #import <ActionSheetPicker_3_0/ActionSheetPicker.h> #import <SSZipArchive/SSZipArchive.h> #import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h> 

I explicitly included $(inherited) in the Header Search Paths, the User Header Search paths, and the Framework Search paths but the error does not go away. Does someone have an idea on how to fix this?

like image 644
productioncoder Avatar asked May 22 '16 17:05

productioncoder


People also ask

What is Use_frameworks?

use_frameworks! tells CocoaPods that you want to use Frameworks instead of Static Libraries. Since Swift does not support Static Libraries you have to use frameworks.

Where is the Podfile in Xcode?

The Podfile is located in the root of the Pods project. An easy way to open it is via "Open Quickly" (Shift Cmd O) typing Podfile.

Where is CocoaPods cached?

By default CocoaPods stores repositories in your home folder in ~/. cocoapods and caches Pods in ~/Library/Caches/CocoaPods .

Where do I install CocoaPods?

To install the pods, do one of the following: Place the caret at the code line where you add the pod, press ⌥ ⏎ , select Install, and press ⏎ . Click Install pods in the top-left corner of the editor window. From the main menu, select Tools | CocoaPods | Install.


2 Answers

The error message is quite misleading. At first I thought I have some problems with my header search paths, so I basically tried everything I found on stackoverflow.

If you use use_frameworks! in your Podfile, you don't have to include every Objective-C pod in your bridging header. You only have to do this, if the pod is distributed as a static library, not as a framework.

I did the following

  1. Press Cmd + option + shift + k to clean your build folder
  2. Run pod install
  3. Delete the lines in your bridging header where it tells you that the header files are not found and use a simple import statement whenever you want to use that module in one specific Swift file, e.g. import AFNetworking
like image 94
productioncoder Avatar answered Sep 28 '22 03:09

productioncoder


I tried remove ~/Library/Developer/Xcode/DerivedData/* and rebuild the project, and it worked for me.

like image 33
always_beta Avatar answered Sep 28 '22 03:09

always_beta