• 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: Failure on unarchiving a NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Failure on unarchiving a NSBezierPath


  • Subject: Re: Failure on unarchiving a NSBezierPath
  • From: an0 <email@hidden>
  • Date: Fri, 25 Apr 2008 17:10:08 +0800

Sorry for my careless, I though Jens was talking about the `read' part.
However, as I said, the error occurred when reading not when writing.
So it was not because
> NSKeyedArchiver returned nil
but because
`[NSKeyedUnarchiver unarchiveObjectWithData:data]' returned nil, and
my `readFromData:(NSData *)data ofType:(NSString *)typeName
error:(NSError **)outError' returned NO without setting `outError'
(thanks Jens let me learn this point).
OK. Now I'm just wondering why `[NSKeyedUnarchiver
unarchiveObjectWithData:data]' returnes nil, since I've saved the data
without any error as I can see.
Thanks a lot if you or others can give me some more hint.

On Fri, Apr 25, 2008 at 4:29 PM, Kyle Sluder
<email@hidden> wrote:
> On Fri, Apr 25, 2008 at 4:11 AM, an0 <email@hidden> wrote:
>  > Thanks. But it seems you haven't read to the end. As I said in my first mail:
>  >
>  > > Besides, I found the value returned by [NSKeyedUnarchiver
>  >  > unarchiveObjectWithData:data] was nil, but I didn't understand why,
>  >  > since it was normal when I saved the file using [NSKeyedArchiver
>  >  > archivedDataWithRootObject:view.drawing].
>
>  But you apparently haven't comprehended Jens' message.  You're not
>  setting *outError to anything, so whoever is calling your method is
>  seeing that you've returned NO and is expecting whatever it passed in
>  as outError to point to an NSError object.  Unfortunately this is not
>  the case and whatever was in that memory location is receiving bogus
>  messages -- particularly, -localizedFailureReason, which is an NSError
>  method.
>
>  In short, you're breaking the contract for messages which take an
>  NSError**.  Set *outError to an NSError object (or nil if you're lazy)
>  if you're going to return a value that signifies an error.
>
>  --Kyle Sluder
>
_______________________________________________

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

  • Follow-Ups:
    • Re: Failure on unarchiving a NSBezierPath
      • From: "Kyle Sluder" <email@hidden>
References: 
 >Failure on unarchiving a NSBezierPath (From: an0 <email@hidden>)
 >Re: Failure on unarchiving a NSBezierPath (From: Jens Alfke <email@hidden>)
 >Re: Failure on unarchiving a NSBezierPath (From: an0 <email@hidden>)
 >Re: Failure on unarchiving a NSBezierPath (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: Failure on unarchiving a NSBezierPath
  • Next by Date: Initial value of on/off buttons
  • Previous by thread: Re: Failure on unarchiving a NSBezierPath
  • Next by thread: Re: Failure on unarchiving a NSBezierPath
  • Index(es):
    • Date
    • Thread