-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 (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:
http://lists.apple.com/mailman/options/cocoa-dev/rix.rob%40gmail.com
This email sent to rix....@gmail.com
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com