Download iOS files - NSDocumentDirectory

I am working on a library with a very detailed log module that on iOS writes xml logs to NSDocumentDirectory in a consistent file tree. I want the user of this library to be able to easily access these logs.

I know that it is easy to programmatically extract files from this directory, but is it possible to access this directory on an iOS physical device in any way from outside of Xcode to extract these logs? I like it. I saw it somewhere earlier, something like how to extract the .ipa file and go to the package contents, but I could be wrong.

----------------------------------------------- --- ------- EDIT --------------------------------------- --- ------------------------

This is ( View files created on the device by the iOS application that I am developing on the workstation? ), How to do this with Xcode on the device, but I have to assume that there is a way that we can create that displays the logs to the device for the user.

+5
source share
2 answers

Is there any way to access this directory on the physical iOS device from outside of Xcode to extract these logs?

You can open the Documents directory by enabling iTunes file sharing. When file sharing is enabled using this method, the contents of the Documents directory will be displayed to the user in iTunes, which can also be exported. Documents will also be displayed for export through some third-party desktop applications such as iExplorer.

Here is a link to the Apple documentation. You can also refer to this one to understand how this is done.

+1
source

If you use a simulator (apparently your task does not seem to need a real device), you're in luck.

You should go to a folder like this:

/ Users / [username] / Library / Developer / CoreSimulator / Devices / [RANDOM_HASH_YOU_SHOULD_DISCOVER] / data / Containers / Data / Application / [RANDOM_HASH_2_YOU_SHOULD_ALSO_DISCOVER]

Once there, using finder, you will get the simulator โ€œdocumentsโ€ folder and the application from which you are trying to get your logs.

You could say: I do not know which 2 RANDOM_HASHES I should go to. Yes you are right. If you have many simulators installed or used, it can be difficult to find which one you are trying to debug. The same thing with your APP, your application will live in a different RANDOM_HASH folder, and you must view them one by one, and then open the document folder.

Someone needed to solve this โ€œmessโ€ and create the Xcode Alcatraz Extension, which will lead you to an accurate real-time simulator and APP that you are debugging at any time, and then you need to guess which 2 random_hash paths you need to go to to.

If the Xcode + Alcartaz plugin extension manager is a little inappropriate for you, you may need Google. This is not a complicated process.

PS: This Alcatraz magic extension is called "XcodeWay" (if you are brave enough to install Alcatraz on your copy of Xcode).

EDIT: Useful link for getting Alcatraz: http://alcatraz.io/ Follow its simple instructions and you're done.

EDIT2: If Xcode cannot be used, then the last question in this other thread may be useful: Browse the files created on the device by the IOS application I'm developing on the workstation? (However, an external application on your computer is required)

+1
source

Source: https://habr.com/ru/post/1244876/


All Articles