Greetings

I'm having problems unarchiving my data in the iphone.

here is the workout.

1: I archive a AttributedString to my CoreData NSData property using 
NSKeyedarchiver
2: Transfer the database to the iphone.
3: load the data using NSKeyedUnarchiver on the iphone.
NSAttributedString *as = (NSAttributedString*)[NSKeyedUnarchiver 
unarchiveObjectWithData:attributedStringData];

that crashes saying:
-[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSFont)

I understand that the NSFont is UIFont on the iphone, or has similarities.
so i implemented a Delegate method to replace the class.
//------------------------------------------------------------------------------
- (Class)unarchiver:(NSKeyedUnarchiver *)unarchiver 
cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray 
*)classNames{
        if ([name isEqualToString:@"NSFont"])
                return [UIFont class];

        return nil;
}

but that never gets called because the class method does not allow for a 
delegate and instantiating the unarchiver class confuses me in how I should 
trigger the decoding once it is instantiated.

Any pointers ?
Sandro Noel.



_______________________________________________

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

Reply via email to