首页 > 代码库 > iOS - Usage of NSData

iOS - Usage of NSData

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 = http://www.mamicode.com/(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;            }