Re: Sandboxing. WTF?
Re: Sandboxing. WTF?
- Subject: Re: Sandboxing. WTF?
- From: Graham Cox <email@hidden>
- Date: Thu, 31 May 2012 08:57:57 +1000
On 31/05/2012, at 12:56 AM, Michael Nickerson wrote:
> The CFPreferences... calls will actually take a path. Just give it the path where the bundle ID should go. This is not documented anywhere, but it works.
Hmmm... well, relying on undocumented behaviour sounds like it could be a worse cure than the disease, but I'll experiment.
> If you'd rather not count on that always working, you don't have to parse the plist yourself, just read the plist in as data and use NSPropertyListSerialization (or CFPropertyList, if you need the CF calls for some reason) to parse it.
Even easier is just to use [NSDictionary dictionaryWithContentsOfURL:]
> It does not solve the main issue. You assume the preferences are stored in property list, which is something not documented.
> Nothing prevent Apple to change it again to an other format that is not a property list, as the only documented way to access it is using CFPreferences/NSUserDefault API.
True, and this is why the real solution is for Apple to give us an API for accessing iApps media files fully isolated from their implementation details. However, so many apps out there in the wild are doing this (either through Karelia's iMedia framework, or their own solutions) that Apple would be risking breaking a lot of apps unnecessarily if they were to make such a change without thought. While I wouldn't put it past them these days, they do have a fair track record of not breaking apps gratuitously. Also, there's no particular reason to change the format for plists which has been stable for a very long time.
Much more likely is that keys in the preferences files could change, or that the name of the file could change, or its location. CFPreferences would dodge the last two, but nothing currently would be proof against the first one, and my app is just as weak as all the others in assuming the value of that key. All I can do is fail gracefully (I do) and expect to rev my app if and when iPhoto/iApps changes its disk layout.
This is all now working with sandboxing enabled, though it feels like a pretty fragile pile of cards. I expect it to break. And there's still the question of whether the necessary temporary exemptions I need to get it past the sandbox demon (aptly named) will also be permitted by the App Store.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden