float INFINITY can be archived by NSCoder, but not dearchived
I have to archive a float with value INFINITY , and later to dearchive it. Here is my example code: Object to be archived: @interface CodeInf : NSObject <NSCoding> @end @implementation CodeInf - (void)encodeWithCoder:(NSCoder *)encoder { float inf = INFINITY; [encoder encodeFloat: inf forKey:@"INFINITY"]; } - (id)initWithCoder:(NSCoder *)decoder { if (self = [super init]) { float decodedInf = [decoder decodeFloatForKey: @"INFINITY"]; } return self; } @end And here is the archiving/dearchiving code: CodeInf *myCodeInf = [[CodeInf alloc] init]; NSData *data = [NSKeyedArchiver