Take the 2-minute tour ×

Not sure what the mistake i am doing. Please suggest. In my application i am creating a database, and when i relaunch the application next time, the database is not seen. I found what the problem is, but not the solution .

 NSArray *dirPaths;
    NSString *docsDirectory;
    NSString *databasePath;
    dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    docsDirectory = [dirPaths objectAtIndex:0];
    databasePath = [[NSString alloc] initWithString: [docsDirectory stringByAppendingPathComponent: @"MYDATABASE.db"]];
    NSLog (@" Database Path : %@ ",databasePath);
    const char *dbpath = [databasePath UTF8String];

Unfortunately, i get the following path printed.

Database Path : /var/mobile/Applications/27C4C465-0D65-44AA-BBB3-693G4D1CDD4D/Documents/MYDATABASE.db

When i reinvoke the application i get the different path ie: 27C4C465-0D65-44AA-BBB3-693G4D1CDD4 is replaced with some other value, that's why it could not able to locate the database properly.

How can i resolve this issue? Kindly suggest.

share|improve this question
That long hex string is the App's UUID, which shouldn't change between runs. Is this during development or in production? –  trojanfoe Nov 15 '12 at 15:32
trojanfoe, it is in the development. –  Whoami Nov 16 '12 at 5:45
you want to locate the databese... in finder? –  TonyMkenu Nov 16 '12 at 13:17
add comment

Your Answer



Browse other questions tagged or ask your own question.