• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: False positive on writeToURL:atomically:encoding:error: ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: False positive on writeToURL:atomically:encoding:error: ?


  • Subject: Re: False positive on writeToURL:atomically:encoding:error: ?
  • From: Martin Hewitson <email@hidden>
  • Date: Sun, 24 Jun 2012 17:36:04 +0200

On 24, Jun, 2012, at 05:14 PM, Dennis wrote:

> On Jun 23, 2012, at 10:46 PM, Roland King wrote:
>
>> Yes that is a general statement. You should check the return value of the method and only if it indicates there's an error, check the error object. There is no guarantee that the error object was not set at some point during the method processing, even if that method eventually succeeds, nor that it's forced clear on success.
>
> What if you explicitly set your NSError variable's value to nil immediately before using it? Wouldn't it be safe to trust in that case?


I was doing that (I always do that), but the problem is still there. Anyway, now I've changed the app to follow the recommended approach and I check the return value. I shipped a test version to the user with the problems, but they still get the original error messages. In other words, -writeToURL:atomically:encoding:error: is actually returning NO. The user repaired the file permissions on his disk and after that the files in question showed up as being locked. I'll quote the user here:

"The whole culprit was the new lock feature introduced with Lion. I think files are automatically locked after a few days in Lion. I just repaired the disk permissions and found that the files in question had the lock icon on them. Strangely, the lock icon never appeared for the files before and the "Locked" checkmark was not checked in the info pane for the files. But I guess after repairing the permissions the files were marked as locked.

What is stranger is, even though they were locked, apps like TextEdit were able to save/edit them without warnings. They usually display an alert with an Unlock button on it."

So, as developers, are we supposed to check for this lock status before trying to save programmatically? I guess I've got some reading to do about this lock stuff.

Cheers,

Martin





_______________________________________________

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

References: 
 >False positive on writeToURL:atomically:encoding:error: ? (From: Martin Hewitson <email@hidden>)
 >Re: False positive on writeToURL:atomically:encoding:error: ? (From: Eeyore <email@hidden>)
 >Re: False positive on writeToURL:atomically:encoding:error: ? (From: Martin Hewitson <email@hidden>)
 >Re: False positive on writeToURL:atomically:encoding:error: ? (From: Roland King <email@hidden>)
 >Re: False positive on writeToURL:atomically:encoding:error: ? (From: Dennis <email@hidden>)

  • Prev by Date: Re: False positive on writeToURL:atomically:encoding:error: ?
  • Next by Date: Document-scoped security conundrum (and bug)...
  • Previous by thread: Re: False positive on writeToURL:atomically:encoding:error: ?
  • Next by thread: Re: False positive on writeToURL:atomically:encoding:error: ?
  • Index(es):
    • Date
    • Thread