Link sqlite database to iOS map for suits

I have developed a custom ios framework to achieve some task that works great, but I have to add the sqlite database separately in my test application. I want to bind my sqlite database to my custom framework so that it will automatically be added to any application where the user wants to use this framework.

I also don't want to show the sqlite database to anyone. can anyone tell me the best way to achieve this.

Thank you in advance

+3


source to share


2 answers


I believe you want to ship a sqlite database with your application and install it invisibly to the user. Just add the database to NSBundle by including it in your application. The important part is that you have to copy this linked database to the filesystem (perhaps you want to mark it as non-cloud as well), since NSBundle'd files are read-only. So, here is your strategy: 1) at startup, check if the database is on the filesystem. 2) if not, copy it from NSBundle to the filesystem, 3) open the database in the filesystem.



0


source


There may be a better solution to your question, but here is a suggestion that you could: Programmatically create a database in your structure As far as hiding the database is concerned, this is the solution ! You can also encrypt the sqlite file .



Greetings

0


source







All Articles