Is it possible to view the contents of files in the iOS Application sandbox while debugging?

前端 未结 5 1058
忘掉有多难
忘掉有多难 2021-01-30 10:13

I\'d like to check the contents of an XML file at a specific point of execution while debugging in Xcode. Is it possible to view the contents of the file, either through the Org

相关标签:
5条回答
  • 2021-01-30 10:38

    Updated answer for Xcode 6:

    The Devices tab now has it's own window (Window -> Devices). Find your Device, then your App. There is no 'download' button (unless the log window is visible... then the Download icon there actually saves the Log).

    If you DOUBLE-CLICK on your app, a new window will become visible that shows a read-only, non-interactive representation of that app's sandbox.

    To download the app container, select an app, click the "Gear" and "Download Container." It'll take a bit of a while, during which time there is no indication of the progress; but a Finder window will appear, showing with your .xcappdata file. You can also "Replace Container" which looks cool and exciting.

    0 讨论(0)
  • 2021-01-30 10:43

    You could enable file sharing (set the UIFileSharingEnabled flag in info.plist) and store the file where it can be accessed via iTunes (i.e. in the Documents folder).

    0 讨论(0)
  • 2021-01-30 10:44

    Simply open the organiser and click the 'Download' button at the bottom, then right click on the xcappdata file and select Show Package Contents.

    0 讨论(0)
  • 2021-01-30 10:48

    I have just discovered that you can in fact save the entire contents of the sandbox to disk at any time. Simply open the organiser and click the 'Download' button at the bottom. This saves the sandbox to disk as a .xcappdata file. I'm not sure how to open this as it is, but I have found that if you change the file extension to .xml, you can browse it using finder just like a normal directory.

    It's a shame you can't download single files if required and that the whole process is a little cumbersome, but it does allow me to achieve what I wanted in the end.

    0 讨论(0)
  • 2021-01-30 10:52

    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 [NSDictionary dictionaryWithContentsOfFile: filePath];.

    0 讨论(0)
提交回复
热议问题