1) I have the CoreData.framework imported. In Groups & Files I see it in the Framworks list together with UIKit.framework, Foundation.framework, CoreGraphics.framework.
2) I have this code, I am not sure what this error means
#import <UIKit/UIKit.h>
@interface SQLLiteDemoAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *wi开发者_开发技巧ndow;
MyTableViewController *myTableViewController; //error on this line
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
MyTableViewController.h looks like this
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
@interface MyTableViewController : UITableViewController {
NSMutableArray *names;
}
@end
MyTableViewController is not declared where you're using it so compiler can't know how to treat that name. You have 2 options how to fix that:
- just import the MyTableViewController.h in your SQLLiteDemoAppDelegate.h file
use forward declaration in your header class and import SQLLiteDemoAppDelegate.h in .m file:
//SQLLiteDemoAppDelegate.h @class MyTableViewController; @interface SQLLiteDemoAppDelegate : NSObject <UIApplicationDelegate> { ... //SQLLiteDemoAppDelegate.m #import "MyTableViewController.h" ...
Have a look at
http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/ObjectiveC/Articles/ocDefiningClasses.html
the part about "Referring to Other Classes".
If the interface mentions classes not in this hierarchy, it must import them explicitly or declare them with the @class directive
In your case that would mean you have to insert
@class MyTableViewController;
before the declaration of the interface.
精彩评论