2017年4月27日 星期四

[iOS] How to read byte in NSData?

如何從NSData讀Byte? 
 
NSData * theData = [NSData dataWithContentsOfFile: path];
const char* theBytes = (const char*)[theData bytes];
 
那讀幾個Byte?
 
NSRange range = NSMakeRange(location, length);
NSData *someData = [theData subdataWithRange:range]; 
const char* theBytes = (const char*)[someData bytes];

沒有留言:

Class has no initializers in swift

Class has no initializers in swift I have met this situation. Found a solution here It says if you have the code like bellow var se...