在 iPhone 应用程序中,我有一个NSDictionary对象,其键为NSString,值是自定义对象。我正在尝试将其转换NSData为 iCloud。我这样做了:
NSMutableData *data = [NSMutableData data]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; [archiver encodeObject:myDictionary forKey:@"mykey"]; [archiver finishEncoding];
现在,encodeObject 行抛出了这个异常(NSDictionary对象'myDictionary'中有值。我检查了。):
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ConnectionProfile encodeWithCoder:]: unrecognized selector sent to instance 0x1f849350'
ConnectionProfile 是我作为值存储在NSDictionary. 它应该NSCoding明确实施吗?