Failure on unarchiving a NSBezierPath
Failure on unarchiving a NSBezierPath
- Subject: Failure on unarchiving a NSBezierPath
- From: an0 <email@hidden>
- Date: Wed, 23 Apr 2008 23:42:32 +0800
I was building a very simple drawing application, but met problems
when reading the file saved by my application.
The two functions as to archiving/unarchiving are as follows:
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
return [NSKeyedArchiver archivedDataWithRootObject:view.drawing];
}
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName
error:(NSError **)outError
{
NSBezierPath *drawing = [NSKeyedUnarchiver
unarchiveObjectWithData:data]; //*** returns nil
if (drawing == nil) {
return NO;
} else {
view.drawing = drawing;
return YES;
}
}
Nothing appeared when I opened a saved file, and log said:
2008-04-23 23:33:44.127 EasyDraw[631:10b] *** -[NSDocumentController
localizedFailureReason]: unrecognized selector sent to instance
0x11b210
2008-04-23 23:33:44.128 EasyDraw[631:10b] *** -[NSDocumentController
localizedFailureReason]: unrecognized selector sent to instance
0x11b210
I don't know what the log means.
Besides, I found the value returned by [NSKeyedUnarchiver
unarchiveObjectWithData:data] was nil, but I didn't understand why,
since it was normal when I saved the file using [NSKeyedArchiver
archivedDataWithRootObject:view.drawing].
_______________________________________________
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