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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to