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;
}