I added class files from another project to my new iPhone Window for the first time. The class is a simple class that defines a polygon, and subclasses NSObject. As part of the standard template for an Objective C class, this class definition imports Cocoa.h
#import <Cocoa/Cocoa.h>
However, just by adding this class, I'm getting an error that
Cocoa/Cocoa.h:No such file or directory.
I don't understand this because the exact same line occurs in another class definition (the controller) within the same project.
-
Subclasses of NSObject (at least on the iPhone) do not import the Cocoa.h header. Instead, they import Foundation.h:
#import <Foundation/Foundation.h> -
On the iPhone you generally use UIKit instead of Cocoa, which is for Mac OS X.
#import <UIKit/UIKit.h>You might import just the Foundation framework in a model class that doesn't reference any user interface stuff.
#import <Foundation/Foundation.h>
0 comments:
Post a Comment