I am programming an Xcode iPhone app and utilizing sqlite. In an effort to delete all rows from a table, I receive the warning above when I build my code. Does anyone have any suggestions on how to fix this?
Thanks
- (void) deleteData {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory
stringByAppendingPathComponent:@"myDatabase.sqlite"];
if (sqlite3_open([writableDBPath UTF8String], &database) == SQLITE_OK) {
[database executeNonQuery:@"DELETE FROM test;"];
}
[database release];
}
Best Solution
Assuming
somewhere all up ins, it should be noted that
sqlite3_open()
doesn't create an Objective-C object; it creates an sqlite3 database handle, which is, if memory serves, a struct packed in a pointer. It can, in other words, not receive Objective-C messages.*
does not an object make.