Re: Autosave + non-file URL's == trouble
Re: Autosave + non-file URL's == trouble
- Subject: Re: Autosave + non-file URL's == trouble
- From: Charles Srstka <email@hidden>
- Date: Sun, 21 Jun 2015 17:02:47 -0500
On Jun 21, 2015, at 3:13 PM, Quincey Morris <email@hidden> wrote:
>
> On Jun 21, 2015, at 13:02 , Charles Srstka <email@hidden <mailto:email@hidden>> wrote:
>>
>> How do you guys deal with non-file URLs and autosave?
>
> I guess the first question to ask is what makes you think that non-file URLs are usable with NSDocument at all? I don’t see the restriction documented, but there are plenty of APIs in Cocoa that take NSURLs but require them to be file URLs.
I’ve used NSDocument with non-file URLs for years, just not with autosave. (I really, really wish that autosavesInPlace were an instance method instead of a class method, so I could just have it return true conditionally upon the URL being a file URL, but oh well.)
As far as the official documentation goes:
- NSDocument’s documentation is riddled with snippets saying things like "For backward binary compatibility with OS X v10.3 and earlier, the default implementation of this method instead invokes <some older API> if it is overridden and the URL uses the file: scheme.” If *all* URLs were supposed to be using the file: scheme, that distinction would be irrelevant.
- The framework itself has a bunch of console warnings like "writeSafelyToURL:ofType:forSaveOperation:error: must be overridden for your application to support non-'file:' URLs.” that get logged if you use non-file URLs without setting up all the appropriate infrastructure in your app first.
Charles
_______________________________________________
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