Cocoa/Cocoa.h file not found

2019-06-17 22:31发布

问题:

I am using XMPPFramework in my application. I have imported the Cocoa/Cocoa.h in my .m file. But when i build the project Xcode shows an error.

error: "Cocoa/Cocoa.h file not found".

How can i solve this Error?

回答1:

If you're building for iOS then you shouldn't #import <Cocoa/Cocoa.h>. That header only exists on OS X. For iOS you need to include the various framework headers directly (e.g., #import <UIKit/UIKit.h>).



回答2:

Add this line :

 #import <Foundation/Foundation.h>

remove this :

 #import <Cocoa/Cocoa.h>


回答3:

put #import "Cocoa/Cocoa.h" or #import <Cocoa/Cocoa.h> in your .m file

And Alos i don't like Copy and Paste , so please refer this Question/Answer
Cocoa/Cocoa.h Not Found (Error)
It is similar to your Question.