how does iphone access sqlite database in my mac - ios

I am crating an app in Xcode which stores some user information in an SQLITE database called contacts.db in my mac in the documents folder and my simulator is able to pull it up. So everytime a new user sings up, it has to update this DB.
If I publish this app and the app starts running in multiple iphones, will those iphones be able to access same database in my mac by default?
If not how will you make iphones access this contacts.db running in my mac? How do I create that link?

There are different tools for that one of this is iExplorer. You can Download and install it on your mac and access you app data. :)

Related

iOS updated on users phone - now app crashes up on opening - can't find sqlite file

I had an app that I developed a couple years ago - once the users updated to the latest iOS version it began crashing (iOS10).
I have since recreated the app in a web-based version as a PWA and wanted to pull the SQLite file off their phone and import their information into the web app.
Now in xcode when I go to 'Window->Devices' I see their device.
And then click on the installed apps - it doesn't allow me to download the container. If I double click it and open the container - it shows as empty (but there should be an sqlite file there).
I installed iExplorer and went to the app as well - only to find it empty as well.
Is there somewhere else in the system that the sqlite file would be? Or did this iOS update hose the app to the point I should tell users "well, your data is gone - just restart life on the web app"?
If you can't access your app container, one of the left option is to backup the iPhone through iTunes, and explore the backup with an application like iExplorer or iBackupBot.

How to access Xcode database from iPhone app

This is my first iPhone app. I'm using Xcode 7.3.
In the app I used this tutorial to create an sql database using the app (when the user gives permission by pressing a button, it creates the .db file).
Now I would like to know how I can download the database from the app.
Here is why:
The app will be downloaded on someone's device (not via the app store). It is supposed to collect data from a wearable device and store it in the database.
However I don't know how to access that data later on when I have the user's phone. Apparently the db lives in
/var/mobile/Containers/Data/Application/###/Documents
I read that one method is "jailbreaking." But I have never done that and this is not my phone I'm dealing with, it's a client's, so I don't feel comfortable hacking it. Is there another way? Possibly through the terminal (this is how I did it with the android app, using adb)?
Or is there another way I can go about saving the database so that it is accessible/retrievable?
The first answer is correct but incomplete :
Once you have download the Container, the extension is .xcappdata, so you need to right-click on it and select show the package.
Then browse into /library/Application support/ to find your database in .sqlite
You can try to connect the device to your Mac, then in XCode, go to Window, Devices, select your device and app bundle and click "Download Container...".
To see the database, you could use SQLite.

Get database from crashed iOS app

I develop an iOS app and I send it to any beta tester. After 2 month app has a crash and now it doesn't work .
I need to get any information about log or better I need database. How can I get it ? I can connect to my Mac, but I don't know how to access to db data (if is it possible).
It's very important get database information.
Thank you.
In your device, you can access support directories only for applications compiled for development.
Connect your device to your computer. Having launched xcode, open 'Organizer' window (Window->Organizer). On the left hand side of the menu you will have your device displayed. Under your device, select 'Applications'. All the dev applications will be available there. Select the application you are interested in and click 'Download' at the bottom of the window. What happens - the support directories are downloaded. They are stored in bundle with extension '.xcappdata'. 'ctrl' click on the file and menu will give you an option 'Show Package Contents'. You will find there your sql database file.
You can either use XCode Organizer to download the application directory from the device, or if the tester is remote ask them to install a program like iExplore that lets you simply copy application directories off of the device to send to you.

Backup and Restore sqlite db during new version release

I am working on an iPAD application. When a new version is released, I add the version number on the server side db and call it through a webservice and check with the build version of the app. If there is change in the version I am calling a URL to install the new version of the app. What will be the possible solution, not to lose my data from the iPAD app and once the new app is installed I use back the same sqlite db. FYI... I am not using any MDM, and installing the app through an URL. Let me know if I need to explain more in detail.
In the past, app version update usually reset the data to the bundle as packaged in the archive (ipa). The user data in the databases then become lost. (Note: this may have changed in IOS 7 because of the announced incremental update options but I have never been able to check it out).
My way around this is to provide a backup restore facility that creates a Plist in the /Document Folder. this allows the user to extract his data through iTunes File sharing, then restore it back if he or she wishes. If you have a server though, a better way would be to create folders for registered users and program the facility to back / restore from the server. Prompt the user to use the backup prior to any update, and prompt the user to restore data from the server (if available and the database is empty).

Preventing erasure of user data while upgrading iOS application via iTunes

I want to upload a new beta version of my iOS application for beta testers group. Users save their data in the Documents folder. What do I need to do in order for users to upgrade their application without losing their data?
The Documents directory is not overwritten when you update an app so as long as your data is compatible between versions, you shouldn't have to do anything special.
Alternatively, for developers, Xcode's Organizer allows you to extract the contents of an apps Documents directory easily.
Downgrading iTunes to 7.7 seems solved the problem on Windows

Resources