Are there any tools for browsing iCloud data of your app? - iphone

I am working on integrating iCloud in my app and sometimes having problems with conflicts and save errors. The fact that the data is stored on the cloud makes it very hard to debug the problems.
As far as I know, the data on the iCloud servers are mirrored to a directory on the device. Is there any tool (an iOS or OSX app) that will allow me to see the contents of this directory or the files in the iCloud servers? I know that it is possible to query the files in the directory with NSMetadataQuery class. However, I am looking for a built-in tool from Apple or an open source application that I can use with my own entitlements.
So far I have tried the following tools with no luck:
On Mac OS X Lion, System Pereferences >> iCloud >> Manage: This only displays the name and size of the documents. It does not allow me to download or see the content.
On iOS 5, Settings >> iCloud >> Storage & Backup >> Manage Storage: Same as above.
On Xcode 4.3.2, Organizer >> Devices >> >> Applications >> Download: This allows me to download the application data but it does not contain the iCloud data.
I have also tried browsing the phone with iPhone Explorer application but it does not display the contents of /private/var which is where the iCloud data is stored.

...or visit http://developer.icloud.com to see what is actually stored in the cloud on Apple's servers...

I found the answer to my question in this answer.
It turns out the data on the cloud is automatically downloaded to my mac under "~/Library/Mobile Documents" folder if I enable "Document & Data" in iCloud Settings page and install a Mac app that is using iCloud.

Currently there is no documented way to view native iCloud data. However, depending on what your data is, you might be able to view it under some circumstances. For example, iCloud can be used to sync databases that are accessed via CoreData. If you store your data in a Sqlite database, which is then managed and accessed via CoreData, you can use 3rd party desktop apps to view the Sqlite file. I use this tool to view my Sqlite databases on a Mac: http://www.sqlabs.net/sqlitemanager.php

Related

Is it possible to view data stored in Core Data on a development iphone?

Is there a way to grab/view the coredata db (sqlite store) off of the development iphone through xcode or some other means? While I've been able to inspect the db created through the simulator on my mac, I'd like to validate what's on the actual phone (without having to create debugging views in the app, etc.) as i'm reading sensor data and storing it in coredata.
Yes you can using Xcode organizer.
Select you phone, then app, and you can export and import files from/to the sandbox
http://developer.apple.com/library/ios/recipes/xcode_help-devices_organizer/articles/copy_app_data_from_sandbox.html#//apple_ref/doc/uid/TP40010392-CH14-SW1
I'm not sure if there is an official way to do this but I use a piece of software called iExplorer formerly iPhone Explorer. http://www.macroplant.com/iexplorer/
You can then browse the Apps directory similar to the simulator and find your app and goto the documents directory and grab the sqlite file.
Hope this helps

Can I access filesystem of my iPhone using Xcode?

Is there any way to get access directly to the filesystem of iPhone connected to my Mac using Xcode?
Please keep in mind that the question is NOT about accessing filesystem from application (which is not possible outside of the application's sandbox) but about accessing it from Xcode.
The actual problem is with data on my iPhone which was somehow corrupted while developing several applications. The problem becomes even more stupid because of corrupted data being copied while doing backups and restoring system from it.
Maybe there are other ways to access device's filesystem without jailbreak?
Connect your iPhone and fire up Xcode. Open the Organizer and select your device, and then 'Applications'. You will now see a list of applications that should look familiar to you ;)
Select an app and click 'Download' at the bottom of Organizer.
If you wait long enough, you can even see the files down in 'Data files in sandbox'.

Any way to get your SQLite DB off 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

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 to transfer Core Data store from provisioned iPhone to iPhone simulator?

I have a lot of data stored in my app on my provisioned device, and I want to do additional testing on my computer which is much faster than using the device. What is the best way to transfer the data store into the iPhone simulator so I can access it on the computer?
I think that you can download the data from your device in the Organizer in Xcode.
Once you unzip that folder you should be able to find your sqlite database file.
Now look for the folder on your hard drive where the simulator keeps its files. I think it's somewhere in ~/Library/Application Support/iPhone Simulator or something like that. There should be a folder for each app somewhere in there (the folder name will be some random ID), and you should be able to find an sqlite database with the same name. Replace that database with the one you downloaded from the device.
Sorry I can't give more detailed instructions. I'm at work currently and don't have access to my Macbook to get the exact folder names and such.