SQLite insert works in simulator but not on device

后端 未结 2 474
星月不相逢
星月不相逢 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.

    0 讨论(0)
  • 2021-01-25 18:55

    What worked for me was deleting the app from your device,restart the device,clean the app in Xcode then load it again,also check that Target Membership is selected on the database.

    0 讨论(0)
提交回复
热议问题