开发者

Cannot commit in sqlite using a wrapper

开发者 https://www.devze.com 2022-12-29 10:01 出处:网络
- (IBAction)SetupButtonPressed:(id)sender { Sqlite 开发者_开发知识库*sqlite = [[Sqlite alloc] init];
    - (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.

0

精彩评论

暂无评论...
验证码 换一张
取 消