• 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
[iPhone] NSKeyedArchiver with NSValue Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iPhone] NSKeyedArchiver with NSValue Objects


  • Subject: [iPhone] NSKeyedArchiver with NSValue Objects
  • From: "Henry McGilton (Boulevardier)" <email@hidden>
  • Date: Thu, 24 Dec 2009 09:59:44 -0800

I bashed into a problem with NSKeyedArchiver trying to encode
NSValue objects.

I am using NSValue to wrap up CGPoint and CGSize structures, then
doing an  encodeObject:  forKey:  to encode the NSValue.

I get this message:

    [NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs'

I poked around in CocoaBuilder and Google for some definitive answers, but
the discussions appear to be mostly froth.     This seems a little strange, as UIKit
provides a bunch of NSValue additions to encode those CG structs, but the
NSKeyedArchiver can't encode them.     And the message is somewhat misleading:
I'm encoding the NSValue object, not the structure . . .    I'm assuming (I know, one
should never assume) that the NSValue object is invoking that   encodeValueOfObjCType:at:
message . . .

I'd like to get some clarification or definitive answers on what's going on . . .
The available discussions I was able to find were not very helpful . . .

In the meantime, for anybody else tripping over this, I worked around it by

    encodeObject: NSStringFromCGPoint(point)  forKey: locationKey

    Cheers,
        . . . . . . . .    Henry

=================================================
iPhone App Development and Developer Education . . .
        Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
        Visit  www.trilithon.com

_______________________________________________

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: [iPhone] NSKeyedArchiver with NSValue Objects
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: NSTableview datasource issues
  • Next by Date: Setting the Line Height/ Line Spacing in an NSTextView.
  • Previous by thread: Re: Adding sub menus programatically [SOLVED]
  • Next by thread: Re: [iPhone] NSKeyedArchiver with NSValue Objects
  • Index(es):
    • Date
    • Thread