const char *string ="Hi there,this is a C string";
NSData *data=[NSData dataWithBytes:string
length:strlen(string)+1];
NSLog(@"data is %@",data);
NSLog(@"%lu byte string is '%s'",[data length],[data bytes]);
이것은 암시 될 수 있습니다. 마지막 문장 인 경우 :NSLog in Objective-C에 관하여
NSLog(@"%d byte string is '%s'",[data length],[data bytes]);
는 그 변환이 'INT'를 입력 지정 경고하지만 인수는
왜 %d
수 없어 ('긴 aka'usigned)'NSUInteger '입력있다?
http://stackoverflow.com/a/6727693/944634 –