Search code examples
ioslldb

Transfer file from iOS app to computer while debugging


For a native iOS application we are integrating a C++ library which is writing some logs to disk to json file.

During debugging, we would like to access to this logs, but currently we can only do it by downloading the whole app container to the macOS machine and searching for the file there.

Since this a very time consuming operation we were hoping that there would be some solution that would allows us to get this file quickly. I did take a look to the lldb commands, but none of them seem to let you extract a file from the phone.

Is there anyway to do this in a quick way?

Thank you


Solution

  • Couple options...

    1 - Add debug-only code in your app to share the log file (via AirDrop would probably be a good option).

    or

    2 - During debug, set these two keys (in project settings / info) to Yes:

    Application supports iTunes file sharing
    Supports opening documents in place
    

    Once you've done that, you can open / copy files from your app's Documents directory (assuming that's where the logs are being written) from Finder on your Mac.