NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS
NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS
- Subject: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS
- From: Sandro Noël <email@hidden>
- Date: Wed, 11 Aug 2010 16:53:14 -0400
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 (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