0

I've an issue with sqlite in my iOS project. My configuration:

  • Lion
  • Xcode 4.3.2 - iOS 5.1
  • sqlite3 database whit one table named "test"

When I install my app on the device, I receive this error message in the console "no such table test". But the table exists surely.

The strange thing is this: if I create the same project (identical) on another Mac whit the following configuration the app works perfectly:

  • Snow Leopard
  • Xcode 4.2 - iOS 5.0
  • sqlite3 database whit one table named "test"

Moreover, if I install the project created by first configuration (Lion - Xcode 4.3.2) on the second Mac whit the second configuration (Snow Leopard - Xcode 4.2), the app still doesn't work.

Instead, if I install the project created by second configuration (Snow Leopard - Xcode 4.2) on the Mac whit the first configuration (Lion - Xcode 4.3.2), the app works.

This problem is driving me crazy ! Anyone have an idea ?

Fry
  • 6,235
  • 8
  • 54
  • 93
  • 1
    Make sure that the sqlite database file is added in the `Copy Bundle Resources` list in `Build Phases` on your target settings. – Alladinian May 04 '12 at 15:41
  • That's great. I have also posted this as an answer for any person who may stumble upon this in the future. – Alladinian May 04 '12 at 18:00

1 Answers1

6

Make sure that the sqlite database file is added in the Copy Bundle Resources list in Build Phases on your target settings. Many sqlite connectors have a function that checks for the database file and if not present they create it on the fly. So, you get no errors while accessing it but also there are no data in it.

Alladinian
  • 34,483
  • 6
  • 89
  • 91