Is the Sqlite file included in the submission to App Store? - ios

I am developing my first application for iOS. I use data I uploaded in the Sqlite Db using core data.
I would like to know if the Sqlite file is included in the generated Archive file by Xcode, if not, how to have these data available in the final application in app store ?
Thanks for help.

Yes, you can include the database as part of the other resources just like any other resource. Note, however, that it will be read-only, and you can only use it as a read-only database for searching, or for seeding a read-write database.

Related

Copying Sqlite database file content in CoreData

I'm working for an iOS app that was earlier developed using phone gap. It is having a sqlite database for storing data. But now while developing the same app in native, I'm using core data for storing the data.
Now when the new native app replaces the old phone gap app on user's device, I want to copy data from already existing sqlite file into core data.
So when I run the application on device with phone gap build pre installed my app(native) replaces the old build as I'm using same bundle ID but I'm not able to find out the path to that sqlite file. Does sqlite file still exists in documents directory?
If you have an example old database file still installed on one of your devices you could try downloading the App off the device using the Device manager in Xcode.
Then you open up the bundle and search for your file. Then if you know its location / name you can simply access it, read it using some SQLite library and load the data into your CoreData backing store. Keep in mind you either want to mark it in NSUserDefaults or delete the old DB all together so your app does not keep on migrating ( And then maybe accidentally deleting new data from a user. ) I would choose for keeping the old one around for at least a version or 2 so you can verify that your migration works without bugs / deleting user data in the process.
Tip: It is probably a good idea depending on how big your database is to show the user some kind of progress or "migrating / optimizing db" while you're doing this. So you don't end up with the user adding more data to the database before you're done migrating.

sqlite database manager for iOS

I use this https://github.com/sanathp/DatabaseManager_For_Android sqlite manager for my android project which helps me a lot. It's a single class file that enabled me to see my database tables. So I didn't had to work blindly. I could see my database when I'm running the app on device with this manager. Is there any sqlite database manager library for iOS similar to this? I'm using swift for my project & for sqlite database I'm using Sqlite.swift project. Thanks.
Though in android you have it as a activity i kind of have a separate mac app call SqliteBrowser by which i will manage the data
Check it here: http://sqlitebrowser.org/
I would locate the sqlite file in the documents directory(Or location where you store your sqlite file) and will load the sqlite file in this manager
To check the data is inserted correctly
To insert data and check whether i can retrieve via code
The tables inserted into the DB are correct
also you can use sqdatabase sqlite database manager ı made this application for check database you can insert update browse and delete or only check your datas easy to use
link corrected sory you can check from here

Is it possible to stop the installed application database access in iphone

i am doing one application.In that i am using sqlite database.I am storing my information in that sqlite file.But when i install my application in device,user able to access the application database file using iExplorer.Using this application,user can change or delete the database? If yes then how to stop this process.
The only thing you can do is encrypt your data in the database, or find some way to encrypt the whole database file. Look here for some suggestions:
Encrypting SQLite database file on iOS

Sqlite database modifications and app updates in iOS

I'm using a sqlite database in my iOS app. I have all its tables definitions in an .sqlite file I've placed in the "Supporting Files" group of the Xcode project, and in code I copy this file to "Documents" to be able to perform database operations. While developing, I've found that, when I need to add/remove a table or change its fields and I remove the .sqlite file from "Supporting Files" to add the new one, then I need to uninstall the app from the device or the simulator and build again to get the new database.
How could I make changes in database tables by replacing the .sqlite file without having to uninstall the app? When the app will be submitted to the App Store, will the users have to reinstall the app when a new update with changes in database is available?
EDIT. Is it possible to replace the database and to keep/copy the data the user had in the old one? Or will user loose all the stored data when downloading an app update from the Store where the .sqlite database is replaced, as if he were installing the app from scratch?
I've never submitted an app to the Store yet, I need some guidelines about how to handle app updates if I need to make changes in database tables when having such database in an .sqlite file. I'm not using Core Data.
Thanks
for it, you need to modify database by using programmatically. Means, if you want to create/add new table in database then you need to add code like Create Table.... In this case, you can't use predefine database in code.
But if you want to use database instead of writing code, then you need to rename your database and copy all old database data to new database programmatically.
Thanks

How can I ship my app with a pre-populated Core Data database?

My app uses Core Data and I want some default entries to be inside.
What's best practices of how to do that?
If you're already loading the pre-load data via a temporary routine for testing in your current code there's no reason you can't use the sqlite file it creates in the simulator's directory (no need to write a separate Mac app).
If you're not already filling that db you can still write an iOS app that does it. Odds are you've already written the methods for adding data to your store so you can use them to import the pre-load data as well.
Either way you'd grab the sqlite file from the simulator's directory and add it to your app's bundle; on first launch you'll copy it into the appropriate place in the app's directory before pointing Core Data to it. If it's really large the downside is that there will be a copy in the bundle and another on disk, but there's not much you can do about that other than grabbing the data over the network.
As others have suggested, if the amount of data is small you can just import it at first launch, using the methods you've already written for adding data as part of the normal app's workflow.
See the CoreDataBooks example, which has sample code for copying a database at first launch.
EDIT: I've created a Core Data framework (read about it here: http://bikepress.org/?p=1120) that includes this feature.
I would just create a database and put add it to my target so that Xcode copies it into the app bundle. At the first launch just copy it from the app bundle to eg. the documents directory or wherever your app expects the database.
There is Core Data Editor at the app store. Alternatively you could build your own simple mac app just for this particular DB and manage it from there. If the amount of default entries is small, then you're better off storing it in a plist or something and loading it into DB after the first launch.
In iOS 5, my app was rejected if I put a database file into resource bundle. So, I have to download the database from internet instead.

Resources