I want to be able to access a writable file directly in my Xcode project when I am under Xcode, but access to the bundled app version (as read-only) when running a normal version.
The solution is easy, I provide "-EditBootstrapFile $(PROJECT_DIR)/SomePath" as launch argument in my Xcode Run scheme, then access the file. While executing, if I don't find "-EditBootstrapFile", I use the Bundle.main.url version as read-only.
However, Sandbox interferes with my best intentions. I don't seem to find a way to allow the sandbox system to access that particular file.
Since it's a bootstrapping file, it kinda beats the purpose to add up a new window and delay loading of the list of parameters, it's meant to be always present.
So far, the only workaround I found is adding com.apple.security.temporary-exception.files.home-relative-path.read-write with /Developer/myproduct/SomePath in the entitlements, which is dumb, and mean I need to have two different entitlements for my code (one for xcode debugging and one for archiving) and the value is now hard-coded.
Anyone has experience with this? I'm sure there's something easy I am missing, but for now, I lost a few hours and could still not figure it out.