Can I view the contents of files in the iOS application sandbox during debugging?

I want to check the contents of an XML file at a specific execution point during debugging in Xcode. Is it possible to view the contents of a file either through the Organizer (I am debugging using real hardware devices, not a simulator), or by entering some kind of command in the output / console?

I am using Xcode 4.

+55
debugging ios logging xcode xcode4
Sep 13 '11 at 17:13
source share
5 answers

Just open the organizer and click on the Download button below, then right-click the xcappdata file and select Show Package Contents.

+113
Oct 10 '11 at 17:45
source share

Updated answer for Xcode 6:

The Devices tab now has its own window (Window → Devices). Find your device and then your application. There is no “download” button (if the log window is not visible ... then the “Download” icon actually saves the log).

If you use DOUBLE-CLICK in your application, a new window will open in which only the interactive presentation of this isolated read-only software will be displayed.

To download the application container, select the application, click "Gear" and "Download Container". It will take some time during which there is no sign of progress; but the Finder window appears, displayed with your .xcappdata file. You can also “Replace Container”, which looks cool and exciting.

+26
Oct 16 '14 at 4:28
source share

I just discovered that you can save the entire contents of the sandbox to disk at any time. Just open the organizer and click the "Download" button below. This saves the sandbox to disk as a .xcappdata file. I'm not sure how to open it, but I found that if you change the file extension to .xml, you can view it with finder, like a regular directory.

It is a shame that you cannot download individual files if necessary, and that the whole process is a bit cumbersome, but it allows me to achieve what I wanted at the end.

+9
Sep 16 2018-11-11T00:
source share

You can enable file sharing (set the UIFileSharingEnabled flag in info.plist) and save the file to which it can be accessed through iTunes (that is, in the Documents folder).

+6
Sep 13 '11 at 17:25
source share

You can always set a breakpoint, and then, in the console, print the contents of the object you want to examine using "po". Example: gdb> po [dictionary NSDictionaryWithContentsOfFile: filePath] ;.

+3
Sep 13 '11 at 17:28
source share



All Articles