Cannot commit in sqlite using a wrapper
- (IBAction)SetupButtonPressed:(id)sender
{
Sqlite 开发者_开发知识库*sqlite = [[Sqlite alloc] init];
NSString *writableDBPath = [[NSBundle mainBundle]pathForResource:@"Money"ofType:@"sqlite"];
if (![sqlite open:writableDBPath])
return;
[sqlite executeNonQuery:@"CREATE TABLE test (key TEXT NOT NULL, num INTEGER, value TEXT);"];
}
Hey guys the above code runs at first but the next time , the table does not exists in the database ! I am using http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/ what am I doing wrong ?
Or could you please suggest me a really simple tutorial for core data ?
The application bundle is not writable on the iPhone, so you need to copy the database to a writable location in order to be able to make any changes to it.
精彩评论