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 (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 [EMAIL PROTECTED]

Reply via email to