iosobjective-cfmdbios-sqlite

Access pre-existing database(read only) from iOS bundle


I have pre-created database stored in a folder inside my bundle. Can I access it directly from that folder without copying to Document folder?. I don't want to write anything to Db. Only want to read some data. I am using FMDB framework also.


Solution

  • You can get the path to your database using:

    NSString *path = [[NSBundle mainBundle] pathForResource:@"someDB" ofType:@"sqlite"];
    

    Change the parameters to match your database. And then provide that path to your framework so you can access it.