I'm trying to open a database that I have in my project inside Resources.
The problem is that it seems that its impossible to find the database file! I tried with the complete path, and it works, but this is not a good solution.
I would like to now how to open it!
I'm using this code: db = [FMDatabase databaseWithPath:@"bbdd.sql"];
I don't know how to find the other part of the "actual" path.
Do you have a solution for me?
Thanks!!!!
You need to find the full path of the database in the your resource bundle, something like this :
NSString *databasePath = [[NSBundle mainBundle] pathForResource:@"mySQLiteDatabaseFile" ofType:@"sqlite3"];
There's a complete example in this thread Copying data to the Application Data folder on the iPhone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With