views:

16

answers:

2

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 *window;
   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
+1  A: 

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:

  1. just import the MyTableViewController.h in your SQLLiteDemoAppDelegate.h file
  2. 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"
    ...
    
Vladimir
Thanks Vladimir.
Yogesh
+1  A: 

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.

w.m
Thanks w.m. for your answer
Yogesh