Search code examples
swift

How to access and look inside our app sandbox folder when we are coding our app?


I need to look inside my app sandbox while I am developing my app, for example seeing created data file or removing old bookmarks and some works like that, is there an option or button in Xcode for showing the sandbox of our app in macOS apps or iOS apps?


Solution

  • I don't know about buttons, but there is a command to do that:

    open $(xcrun simctl get_app_container 'iPhone 15 Pro Max' io.github.sweeper777.Foo data)
    

    Replace iPhone 15 Pro Max with the name of the simulator, and replace io.github.sweeper777.Foo with the bundle identifier of your app.

    For macOS, the location is fixed, so you can just pass the direct path to the open command

    open ~/Library/Containers/io.github.sweeper777.Foo/Data
    

    Again, replace io.github.sweeper777.Foo with the bundle ID.