0
我有這樣的代碼:'方法'實現在哪裏? (我是新手)
#import "SQLiteDB.h"
@implementation SQLiteDB
@synthesize db, dbPath, databaseKey;
@end
//-------------- check for database or create it ----------------|
- (void)checkForDatabase {
NSFileManager *filemanager = [NSFileManager defaultManager];
NSString *databasePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
stringByAppendingString:@"/ppcipher.s3db"];
if(![filemanager fileExistsAtPath:databasePath]) { //Database doesn't exist yet, so we create it...
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/ppcipher.s3db"];
sqlite3 *db;
if(sqlite3_open(databasePath, db) == SQLITE_OK) {
}
}
}
它抱怨說「法的定義不@implementation上下文」。那麼它到底在哪裏? (我在.h文件中試過,但仍然出錯)
多德 - 去閱讀:http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual /ObjectiveC/Introduction/introObjectiveC.html – bbum 2011-03-08 02:22:07