tags:

views:

29

answers:

1

Hi guys

I am getting a problem when i compile my iphone database application to device. When i debug the code it says database path "out of scope" on the break point and it does not compile the statement. Below is the code i am using to access the database.

databaseName = @"Zen.sqlite";
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

It works perfectly fine when i use the same code on simulator. Please help me to get this work on iphone device as well. Thanks.

A: 

There are usually problems while testing sqlite on iPhone. The simple answer:

  1. Remove your app from the iPhone
  2. Clean all targets in Xcode
  3. Build and install again
Jacek
it works fine when i run on simulator. And when i open the sqlite file from Applications folder of simulator it shows me all the tables and data.the problem arises when i run app on device. I downloaded the application from device and i checked the sqlite database files there were no tables in it.please help me solving this problem. thanks.
Amarpreet
Have you removed your app from the phone? And then installed it again?
Jacek