2012-03-24 52 views
-4

我想:我如何保存一個自定義的NSObject類到文件?

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:dictionary]; 

    BOOL success = [data writeToFile:entryPath atomically:YES]; 

但無論出於何種原因,墜毀與此錯誤:

2012-03-24 20:06:13.550 Journal[1348:707] -[JEntry encodeWithCoder:]: unrecognized selector sent to instance 0x25d1a0 
2012-03-24 20:06:13.553 Journal[1348:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[JEntry encodeWithCoder:]: unrecognized selector sent to instance 0x25d1a0' 

不然怎麼我的NSObject的子類,保存到一個文件?

回答

相關問題