How do I tell my app where my Pod header files are

2019-09-10 11:34发布

问题:

The Question

How do I tell my app where my Pod header files are.

The Setting

I inherited an ios app from someone else. I wanted to add locksmith to the app for passwords. The app already had pods, but pod install wasnt working so I gem installed cocoapods and it worked.

Then I pod installed locksmith and it worked, until I ran my app again.

The Errors

Now I get these errors on pods that I never messed with.

In my Bridge.h file this first line gives an error

#import <TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.h>
#import <DateTools/DateTools.h>

The error response is:

/folders/AppName/Application/Bridge.h:15:9: error: 'TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.h' file not found
#import <TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.h>
        ^
<unknown>:0: error: failed to import bridging header '/folders/AppName/Application/Bridge.h'

The thing is the exact same error occurs but just for DateTools if I remove the first line. So, it seems the path to all my pods isnt working.

I couldn't find where pod paths are located and I am almost certain that this is the issue.

Any help would be much appreciated

EDIT 1

TPKeyboardAvoiding is present in the Pods folder as is the Datetools directory

Pods/TPKeyboardAvoiding/TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.h

EDIT 2

I went to the Build Settings -> Search Paths -> Header Search Paths

and entered: $(inherited)

I also entered: $(PROJECT_DIR)

but I get the same errors

EDIT 3

I just realized that I have 2 sets folders named: Pods, Frameworks and Products.

One is in HostDirectory/AppName and one is in HostDirectory/Pods

回答1:

Show project navigator with cmd+1, then tap on your project root. In the pane that opens you will see your Project and Targets in the left sidebar. Tap on your Target. Then tap "Build Settings" at the top. Tap on that and search for "Header Search Path". You should see something like this in there:

"${PODS_ROOT}/Headers/Public"

If that isn't there, perhaps your cocoapods install didn't work as advertised?

If it is there, you may try clearing your derived data folder. I've had funky things happening with configuration changes that I've resolved by nuking the derived data folder and then doing a clean build.

In terminal punch in:

$ cd "$HOME/Library/Developer/Xcode/DerivedData"
$ open .

Then remove any folder there with AppName in it and then rebuild.

Edit: