• 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: NSCoding, objects that can
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCoding, objects that can


  • Subject: Re: NSCoding, objects that can
  • From: Rob Rix <email@hidden>
  • Date: Tue, 23 Dec 2008 13:55:33 -0500

-conformsToProtocol will do it:

for(id object in [dictionary objectEnumerator]) {
	if(![object conformsToProtocol: @protocol(NSCoding)]) {
		// raise an exception, exclude the object, or whatever
	}
}

Rob

On 23-Dec-08, at 1:47 PM, Alexander Cohen wrote:

Hi, i have a class that contains an NSDictionary. That dictionary is encoded in encodeWithCoder:. Once in a while, a user might put in something liek a CGColorSpaceRef or something similar and everything stops working. Is there a way to find out if bjects in the dictionary can actually be encoded. Keep in mind that they might not always be Obj-C objects. I guess i'm looking for a ObjecTypeCanBeEncoded method or something like that.

thx

AC
_______________________________________________

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

_______________________________________________

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: 
 >NSCoding, objects that can (From: Alexander Cohen <email@hidden>)

  • Prev by Date: NSCoding, objects that can
  • Next by Date: Finding front most window of a document
  • Previous by thread: NSCoding, objects that can
  • Next by thread: NSCoding, objects that can
  • Index(es):
    • Date
    • Thread