I have a weird problem with my iphone application. I have created an sqlite3 database file with console, and added it to project usint "add existing file..." in resource folder, but when i execute project to test with simulator, application couldn't find the sqlite file. I checked Documents folder (/Users/XXXXXX/Library/Application Support/iPhone Simulator/4.2/Applications/XXXXXX/Documents/) and it's empty :^S Please, this problem is getting me crazy, i'm tired of searching a solution through web, could someone help me? Thanks in advance...
2 Answers
It does not go to the documents - it goes to your bundle as resources. To find out the path, use the following:
NSString *Path = [[NSBundle mainBundle] pathForResource: @"myfilename" ofType:@"db"];
1 Comment
Rakius
Thanks so much @viggio24 and @Seva Alekseyev!!! both are right! Finally i used NSString *databasePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: sqliteFileName]; :D:D:D:D