Where can a sandboxed Mac app save files?

前端 未结 4 1604
你的背包
你的背包 2021-02-03 23:45

My Mac app is sandboxed and I need to save a file. Where do I save this file? I can\'t seem to find the specific place where this is allowed without using an open panel. This is

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-04 00:12

    Is is even easier. For sandboxed apps on macOS the function NSHomeDirectory gives you the path where you have read and write access and can save all your files. It will be a path like this

    /Users/username/Library/Containers/com.yourcompany.YourApp
    

提交回复
热议问题