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.
我想获取 NSNumber 的字节值,以便将其转换为 NSData 对象。我需要通过 TCP 连接将它作为字节发送,所以我不能将它编码为 UTF8 或其他任何东西。
提前致谢!
int integer = [num intValue]; NSData *data = [NSData dataWithBytes:&integer length:sizeof(integer)];