Reference link : https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/BinaryData/Tasks/WorkingBinaryData.html
1. create NSData, here msgData is also a NSData:
const Byte * data = (const Byte *)[msgData bytes]; heartbeat.rawData = [NSData dataWithBytes: data length: [msgData length]];
2. Compare two NSData
// if value not changed if([model.rawData isEqualToData:(NSData*)msgData]) { return FALSE; }
iOS - Usage of NSData,布布扣,bubuko.com
原文:http://www.cnblogs.com/mantian/p/3824792.html