Where does the 'method' implementation go? (I'm a newbie)

Posted by Spokane-Dude on Stack Overflow See other posts from Stack Overflow or by Spokane-Dude
Published on 2011-03-08T00:09:21Z Indexed on 2011/03/08 0:10 UTC
Read the original article Hit count: 101

Filed under:

I have this code:

#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)  {

        }

    }
}

It's complaining that "method definition not in @implementation context". So where does it go? (I tried in the .h file, but still get the error)

© Stack Overflow or respective owner

Related posts about objective-c