Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将 NSData 对象转换为 NSString。它本来就是胡言乱语,但我需要它来调试。
当我使用 NSString 的 initWithData 时,它会因为数据有 NULL 字节而中断。如何让它忽略空字节并获得正确的字符串?
将 NSData 逐字节复制到 NSMutableData,跳过任何空字节。然后从中初始化字符串。