1.NSData NSData是Objective-C语言中数据的基本类型,其成分可以理解为字节指针和长度的封装的类,来看看源代码 @interface NSData : NSObject <NSCopying, NSMutableCopying, NSSecureCoding> @property (readonly) NSUInteger length; /* The -bytes method returns a pointer to a contiguous region of mem…
Archiving Objective-C Objects with NSCoding For the seasoned Cocoa developer, this is a piece of cake. For newer developers, this can be a real pain, especially if you don’t know what you’re looking for. I get this question a decent amount, so I figu…
//NSData遵循NSCopying NSCoding协议,它提供面向对象的数组存储为字节 //适用与读写文件,而读写文件的时候需要一个缓冲区,而NSDate就提供了这么一个缓存区 //定义一个char类型的字符串 const char * string = "Hi there ,this is a C string"; //建立缓冲区,把字符串添加进去 NSData * data = [NSData dataWithBytes:string length:strlen(string…