SQLite insert works in simulator but not on device

后端 未结 2 476
星月不相逢
星月不相逢 2021-01-25 18:19

Here is SQLite code which I call and pass one variable. Where is problem?

-(IBAction)insertPet:(NSString *) name{

NSString *query = [NSString stringWithFormat:         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-25 18:47

    My guess is that your database is placed in the application bundle. If that's the case, you will have to create a writable copy of your database to be able to perform queries that change the database (like INSERT or UPDATE). The most popular way of doing so is to copy the database from the bundle to the Documents folder.

提交回复
热议问题