0

I created an iphone app which requires Sqlite for insert, update and delete records.The application is working fine in iphone simulator.

All functions are working (insert, update and delete record). But when I installed it in iphone or ipad. It always lock up, I searched it and they said, I need to copy the database to

the document folder, since you can only read the database from the app bundle. I have a code in the App Delegate class which check if the database is existing in the document folder.

If not it will copy the database from the bundle. I tried it in iphone simulator and it will indeed copy the database if its not existing.

The application really works fine in iphone simulator, no errors at all.

But when I installed it in the device. It will lockup once I insert or updated a record. But its working if I open the table view with the records from the DB and delete it.

I wonder what is the problem of my app, when select and delete is working in the device, but lock up when I tried to insert or update a record.

Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124
althea_15
  • 1
  • 1
  • Try delete the app from the phone clean the project and install it again. – Greg Apr 13 '15 at 11:58
  • In simulator, you can read & write anything in bundle, but not on real device, bundle is restricted to read-only..!! After copying DB to document dir, make sure your are opening and fetching same data from same.. – itsji10dra Apr 13 '15 at 12:03
  • Thank you for your comments. I tried to clean the project and install it again. But the app still lockup. – althea_15 Apr 14 '15 at 16:40
  • I already copy the DB to document dir. Fetching a record from DB and delete it is working in the device, but not insert and update. – althea_15 Apr 14 '15 at 16:42

1 Answers1

0

Steps that you should try (hope one on it will help you): 1) Make clean install application on device. For this: - execute clean command in xCode (menu - product - clean, or cmd + shift + K) - delete application on device - run debug on device.

2) Check if you really copy your database on device in document directory - open devices (menu-window-devices or cmd + shift + 2). Choose connected device then find your application (double tap on application -> you will see content of application directories, You can also download this content to your mac to get more information).

3) Check that you use one DB with required path. 4) Check if your Database file size is zero (sometimes it happens).

More details required to provide you better answer

sfirite
  • 161
  • 4