0

I am making an app that use Core data for as the database for the app to perform an offline mode.(By swift)

So everything works fine but when i builded it on my real Iphone it seems like the database didn't go along with the app and then my app was crashed.

How can i fix it?

Thanks!

Varis Darasirikul
  • 3,013
  • 5
  • 25
  • 35

1 Answers1

0

Most probably your app is running under an assumption that that data will always be present, but this is not the case. Both the instances are different, the one on simulator and the one on real device. So remove that assumption from your code. And make sure you setup the records in the real device also to make sure that you read successfully.

  • i got your point but i can not fix that bec some of the function always be present with the data from the local database. Then i need to copy my database (core data) to every real device when the app is deployed. – Varis Darasirikul Jul 07 '15 at 11:25
  • 1
    Hope this will fix your problem, you will have to ship you app with prepopulated sqllite db: http://stackoverflow.com/questions/29670219/ios-ship-application-with-pre-populated-sqlite-database – Vikram Khorana Jul 07 '15 at 11:38