2011-03-07 35 views
0

这里是我的代码:

(从SQLiteDB.h)Xcode中生成错误(新手)

#import <sqlite3.h> 


@interface SQLiteDB : NSObject { 

    NSString *dbPath; 
    int databaseKey; 
    sqlite3 *db; 
} 

//@property (nonatomic, copy) NSString *db; 
@property (nonatomic, copy) NSString *dbPath; 
@property (nonatomic) sqlite3 *db; 
@property (nonatomic) int databaseKey; 
@end 

=============== (从SQLiteDB。米)

#import "SQLiteDB.h" 


@implementation SQLiteDB 
@synthesize db, dbPath, databaseKey; 
@end 

=============== (从SampleAppDelegate.m)

#import "ReaderSampleAppDelegate.h" 
#import "ReaderSampleViewController.h" 

@implementation ReaderSampleAppDelegate 

@synthesize window; 
@synthesize viewController; 


#pragma mark - 
#pragma mark Application lifecycle 


- (void)applicationDidFinishLaunching:(UIApplication *)application 
{ 
    // create the d/b or get the connection value 
    SQLiteDB *dbInstance = [[SQLiteDB alloc] init]; // Error here <--------- 
} 

==================

错误是:SQLiteDB未声明。

我以为我确实在SQLiteDB.h中声明了它?我该如何解决?

回答

1

使用

#import "SQLiteDB.h" 
在SampleAppDelegate.m

+0

+1一个由一分钟,分别在另两个在五秒7秒打我。 – JeremyP 2011-03-07 20:02:33

+0

我想这应该是显而易见的,但因为我是一个新手,并且肯定会对此非常困难,事实并非如此。非常感谢您的参与。 :d – SpokaneDude 2011-03-07 20:02:52

0

SampleAppDelegate.m包括以下行:

#import "SQLiteDB.h" 
0

您需要:

#import "SQLiteDB.h" in SampleAppDelegate.m or .h 
0

您需要#import SQLiteDB.h进入SampleAppDelegate.m

0

你可能需要在#import "SQLiteDB.h" SampleAppDelegate.m