• 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: NSData returns YES on Fail? (With Example)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData returns YES on Fail? (With Example)


  • Subject: Re: NSData returns YES on Fail? (With Example)
  • From: Seth Willits <email@hidden>
  • Date: Fri, 16 Sep 2005 19:31:21 -0700

On Sep 16, 2005, at 4:49 PM, Seth Willits wrote:

I'm using NSData's writeToURL method to write to a potentially protected file. When I try to write to some place I don't have permission (like /etc/httpd/httpd.conf) NSData returns YES (which is returned as the result of NSDocument's writeToURL:ofType:error:) even though it should fail, and yet somehow the document presents the permissions error sheet.

What's going on?


Here's a project that demonstrates it:
http://www.freaksw.com/temp/CocoaAuthTest.zip

1) Run the app
2) File->Open...
3) Cmd-Shift-G, /etc/httpd
4) Open httpd.conf (or any other file that you know needs authentication to edit [and no, this won't gibble your files])
5) Modify the file
6) Hit save


At this point you'll get an error sheet as you'd expect, but if you look at the run log it will say "Fail stupid!!" which (sorry for the childishness) is a signal that [data writeToURL...] did not fail, and returned YES as the result.

Now 2 things are weird:
1) Why does it return YES and not NO?
2) How is it that it's returning YES in the document's writeToURL method but the document still shows an error sheet?



Thanks for looking,


-- Seth Willits

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSData returns YES on Fail? *Solved*
      • From: Seth Willits <email@hidden>
References: 
 >NSData returns YES on Fail? (From: Seth Willits <email@hidden>)

  • Prev by Date: detecting valid paper name?
  • Next by Date: Creating a new user programmatically
  • Previous by thread: NSData returns YES on Fail?
  • Next by thread: Re: NSData returns YES on Fail? *Solved*
  • Index(es):
    • Date
    • Thread