Any way to get your SQLite DB off iPhone? - iphone

I'd like to analyze the data that I have in my iPhone app after doing some tests, and the data is in a SQLite database. Is there any way for me to be able to copy it off of the iPhone back to my laptop? I'm not aware of any mechanisms that allows me filesystem style access.

You don't need to turn on file sharing in the app to get this, you can get the data for any app you've built via Xcode's devices window.
In recent versions of Xcode (8 and up, I think), open this with Window menu --> Devices. Find the device in the device list and look at the installed apps list for the device. Each app that you've built and installed on the device will be listed (and maybe some others). Select your app and click the gear menu below the list. Clicking the "Download" item on the pop-up menu will enable you to copy the app's documents, library, and other directories to your Mac.
NB: This will download an .xcappdata file. Right-clicking on that and selecting "Show Package Contents" will allow you to drill down to the actual sqlite file.

In Xcode 6 this is available at:
Window -> Devices -> -> Installed Apps.
Select your application.
Click the gear icon -> "Download Container"

You can also use iExplorer (for Windows or Mac, free version available) to browse and copy data on the iphone, without needing to jailbreak it.

If this is your own application you can enable Application supports iTunes file sharing (UIFileSharingEnabled) in your applications plist and your database is stored in your documents directory of your application you will be able to easily access your database through iTunes.
UIFileSharingEnabled (Boolean - iOS)
specifies whether the application
shares files through iTunes. If this
key is YES, the application shares
files. If it is not present or is NO,
the application does not share files.
Applications must put any files they
want to share with the user in their
/Documents
directory, where is
the path to the application’s home
directory.
In iTunes, the user can access an
application’s shared files from the
File Sharing section of the Apps tab
for the selected device. From this
tab, users can add and remove files
from the directory.
This key is supported in iOS 3.2 and
later.
Other Options:
Jailbreaking your phone, adding afc2add through Cydia and then using some type of iPhone Explorer application.
Jailbreak your phone and install ssh and use a tool such as CyberDuck.
There are windows alternatives to both of those applications.

If your iPhone is jailbroken, you can access it through SSH. A program like WinSCP (on Windows) can allow you to connect to the phone and give you filesystem access. Then you can navigate to where your application stores the DB.
There are also multiple Filesystem applications out there that might allow you to do this, but I don't think they will give you the full extent if your phone is not jailbroken.

You can also use iMazing (for Windows or Mac, free version available) to browse and copy data on the iphone, ipad or ipod

Related

How to see the result of sqlite database file in firefox plugin when the app is run on iPhone device

I am using sqlite database in my app. When I run the application from simulator then I am able to see the result in firefox sqlite plugin in my .sqlite file. But when I run on real device then I am not able to see the result so can you tell me how can I see the result and from where I can get that sqlite file.
Short and Simple answer is "You Can't"
When you run on Simulator the generated applicationa nd Document files can be accessed in Library so you can easily check the sqlite file But
When you run on real device the sqlite file is in the document directory inside the device. and Apple does not allow to access the directory from device directly.
1)Enable Application supports iTunes file sharing when editing the info.plist file in Xcode
2)Connect your device to system then open iTunes then click device(such as iPad) then click apps in that you can see file sharing choose your app from that now you can see your sqlite file download that and open using firefox
If you are using Xcode version 6.1 the devices list has moved out of the Organizer. I was able to view the files for my app by:
Clicking Window->Devices and selecting my attached device on the left.
Highlight the application I wanted to view.
Click the settings gear icon below the list and select Download Container.
You are asked where you would like to save the container archive.
In Finder, left click the container archive and select view Show Package Contents.
Navigate to the file/folder you want to view.

Reading iPhone files from PC / Mac programmatically

Applications like iPhone Explorer can show the contents for each installed iPhone application on Mac OS X (even on non-jailbroken devices) when iPhone is connected using USB-cable. I'm trying to do something similar, programmatically copy some files from my iPhone app's folder.
I have done some experiments with open-source frameworks/products built to use iTunes-framework, like iPhoneBrowser and MobileDevice Library. I can connect to iPhone, now the problem is how to enumerate Apps folder items? iPhoneBrowser or MobileDevice Library don't support or provide any easy way for that. Even when hardcoding my application path to iPhoneBrowser it still refuses to display the folder. iPhone Explorer can read the folder without any trouble on the very same device, so it is definitely possible.
Second problem is getting path to apps, on each device they have different path with some hash number folder names. How to 'decrypt' the paths so that I can access my app folder on every device?
the app enumerate use another protocol, you may find some in this https://github.com/phildrip/fruitstrap
I wrote a open source program that works on Windows, here is the github project url:
https://github.com/Moligaloo/iPhoneFS
It can access files on jailbroken iPhone/iPod/iPad (non-jailbroken devices files are limited accessible).
It can also enumerate apps on iDevice.

(iphone) access device's documents directory from mac?

I'm trying to access the documents directory at iphone device to see a log file that I saved while executing the app.
I know this can be done for simulator.
(you can browse the document directory of your app with Finder)
Can this be done for device?
Thank you
In Xcode 6 you should open Devices window to download it.
You can open Organizer in Xcode and download the documents directory when your device is connected right ?
I'm going to combine the two solutions together and add screenshots for clarity. This is with Xcode 7.
View/Download App Documents
Open the Devices window through the menu Window -> Devices.
Select your device.
Select your application.
Click the gear button for the options.
View/Download/Delete Documents through iTunes
IMPORTANT!!!
If you have documents within a subfolder, you will not be able to see or change them through iTunes.
Select the Info.plist file in the Project navigator.
Click the + button next to any property to add another.
Scroll down the list or type to find Application supports iTunes file sharing.
Change boolean value to YES.
Re-build/install application.
Hi Viraj's anwer is the way to go .Here is a screenshot:
iOS provides a framework to share documents between your application & iTunes. Check out the Core Services Layer section of the Apple docs, specifically the File-Sharing Support section. It explains how to do this:
Add the UIFileSharingEnabled key to your application’s Info.plist file and set the value of the key to YES.
Put whatever files you want to share in your application’s Documents directory.
On a side note, if this is just for debugging, you can always print logs using the default NSLog function and check the output using OS X's Console.
You also can use itunes for the same, but to view in itunes make change as below in your .plist
Add new key as "Application supports iTunes file sharing" and make it as boolen with value YES
With MacOS Catalina, Apple has made it very easy for reading the files written from the Documents directory.
Here are the steps:
Once the device is connected to the Mac, it should be listed under the 'Locations' section in Finder as follows:
Select the device. From the tab bar below the device details select 'Files'.
You will be able to see a list of apps that stored files to the Documents directory. Expanding each app will show the files with its document directory.
You can drag and drop these files to any location in the Mac for further use
One way can be to use iExplorer
Download link iExplorer

How to retrive Core Data SQL store from Developer's App on the Developer's iPhone

I need a copy of the store that is saved as Core Data sqlite file inside a test app installed on my device.
I know how to get files out of the the simulator at path: ~/Library/Application Support/iPhone Simulator/[Version]/Applications/[AppID]/Documents
...but i need get the .sqlite file from the app on the device itself.
Unless the app itself has file sharing built in, you can't access the documents folder from outside the app. It is a security precaution and part of the sandbox.
Update:
I misunderstood the context of the question. To get files off a developers iPhone, connect the device and open Xcode>Window>Organizer. Select the device in the lefthand pane. In the righthand pane will be a list of applications. Your custom apps will have an arrow next to it. Hit the arrow and you will see "Application Data" hit the down arrow icon and it will let you download the data to folder. That folder will contain the apps Document, Library and tmp folders.
I wrote an application specifically for this to distribute to my customers and testers of my applications when they have problems. iPhoneRescue is free and allows you to get at all of the backup information in your iPhone; this includes any sqlite files.
All the users have to do is find their device backup, find the application, and then save the application files or just a specific file. (This does not work if they have encrypted their backups).

How can I get to installed app list on iPhone device?

I'm new for iPhone dev.
I got a question for development of iPhone app.
Is it possible to get to installed app list on iPhone device?
thanks.
Connect you device in your system, use following command in terminal
ideviceinstaller -l
you will get the list of app installed in you iphone device
note: you should install ideviceinstaller package in your system
Apps on a non-jailbroken phone are "sandboxed" so you don't get unfettered access to the filesystem. This means that you can't directly see what other applications are available. Also, just because they're installed does not mean that they are available to the current user. For instance, Safari is always installed but can be disabled in the Parental Controls settings.
The best supported (i.e., in a way that Apple will approve of) way of of doing it might be to check the available URL schemes. For example, if "http:" is supported then Safari is usable; if "mailto:" is available then Mail is usable, etc. Of course, not all applications have URL schemes.
You might want to grab yourself a copy of the Apple iPhone Configuration Utility, which will give you a list of installed apps, plus access to the console output from the iPhone.
Grab the iPhone configuration tool and run this regex on the Export:
[ \t]+<key>CFBundleDisplayName</key>[ \t\r\n]+<string>([A-Za-z \&\-,\!]+)</string>
You can then grab the list of apps nice and easily.
Here's what I did, without jailbreaking. (yes it sounds stupid, but it was simple and worked well for me)
Go to your home screen.
Hit the lock button + home button (takes a screenshot)
Open you folders and do the same.
Do the same for any other pages you have.
All the names of installed apps are now in your pictures folder, just copy the pictures to your computer, and finished!