On 20 Feb, 2013, at 9:10, Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote:
> I am trying to build my own version of NSKeyed(Un)Archiver. > > But I do not know how to recognise mutability. Use "classForKeyedArchiver" (or one of the other variants) to detect as which class an object wants to be archived. This will return [NSMutableString class] for mutable strings and [NSString class] for immutable ones. Ronald > > 1. use isKindOfClass: [NSMutableString class] > disadvantage: all strings turn out to be mutable > > 2. use respondsToSelector: @selector(appendString:) > disadvantage: all strings turn out to be mutable > > 3. mutate the string (in a @try block) if exception, then immutable, else > mutate the string back. > disadvantage: very inelegant and probably quite slow > > 4. use some undocumented (which?) method > disadvantage: might break with next OS release > > 5. anything else? > > Gerriet. > > P.S. > I want my own archiver for 2 reasons: > 1. NSKeyedArchiver can store only certain strings > 2. It creates files, which are 10 times bigger than my version (and 5 times > bigger than NSArchiver) > > _______________________________________________ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/ronaldoussoren%40mac.com > > This email sent to ronaldousso...@mac.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com