Question

I'm aware of the methods for migrating a non-sandboxed app to an app sandbox, although I would like to know what the best practices would be for updating files (mostly preference lists) once already in an app sandbox container?

Ultimately if there's a method similar to NSUserDefaults that would work for updating my preference list in an app sandbox container that's what I'm looking to do.

Sources I've read:

App Sandbox Design Guide

NSUserDefaults Class Reference

App Sandboxing

Was it helpful?

Solution

If you're actually storing preferences, just use NSUserDefaults. It works the same (from an API perspective) inside a sandbox as outside. It's really best to pretend that preferences aren't stored in plists though; relying on that implementation detail can have all sorts of unfortunate side effects on recent OSs, so just use the API.

If you're trying to modify arbitrary plists rather than storing preferences, don't use NSUserDefaults. Use NSPropertyListSerialization and read/write them directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top