2011-03-07 76 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