dumbledad
dumbledad

Reputation: 17527

Is there a way in Xcode to browse the contents of the iOS app's NSDocumentDirectory?

For debugging I have saved out a number of files in the standard system directory 'Document', i.e. the NSDocumentDirectory, the one returned by this call

let documentDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!

If I set a breakpoint in my app is there a way in Xcode on the Mac of browsing and examining those files from the iPhone my app is being debugged on?

Upvotes: 1

Views: 582

Answers (3)

yoAlex5
yoAlex5

Reputation: 34225

iOS debug NSDocumentDirectory

Window -> Devices and Simulators -> <select_device> -> <select_app> -> ...(three dots icon) -> Download Container... -> <navigate_to_downloaded_bundle>.xcappdata -> <right_click> -> Show Package Contents -> AppData/Documents

Upvotes: 1

Chris Walken
Chris Walken

Reputation: 408

It should be noted that you have to: navigate to the downloaded container in Finder. Then right click and Show Package Contents -> AppData/Documents

Thanks yoAlex5 for that one!

Upvotes: 0

Enea Dume
Enea Dume

Reputation: 3232

You can download the Container of app in your mac and see the files that are there

In Xcode , select the device, select the app name under Installed Apps, click the settings gearbox, then select Download container. In finder, double finger tap the package and select Show package contents.

see example: go to Window -> Devices

Upvotes: 1

Related Questions