sqlite ios : attempt to write a readonly database

前端 未结 5 1484
天涯浪人
天涯浪人 2021-01-15 05:52

I use a sqlite database for a project. I can do queries like SELECT but impossible to do INSERTs! On the simulator the INSERT works properly. As soon as I compile on my iPod

5条回答
  •  生来不讨喜
    2021-01-15 06:13

    I have found the solution :

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *dbPath = [documentsDirectory stringByAppendingPathComponent:@"tq.sqlite"];
    

    So, i have this error : "no such table: quotes" Any idea ?

    I hope it will be useful !

提交回复
热议问题