私は小さな資産を持っていて、バイトを埋め込みたいと思っていました。アセットを取得し、バイトを出力してから、バイトをバイト配列に入れ、それらのバイトを文字列にロードしました。エンディアンの問題のようです。ここで何が間違っていますか?
BytePrinter.app
const char *helloworldc = "Hello, World!";
NSString *helloworld = [NSString stringWithUTF8String:helloworldc];
NSData *data = [helloworld dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"%@", [data description]);
出力:
<48656c6c 6f2c2057 6f726c64 21>
ByteImporter.App
const uint32_t bytes[] = {0x48656c6c, 0x6f2c2057, 0x6f726c64, 0x21};
NSString *helloworld = [[NSString alloc] initWithBytes:bytes
length:sizeof(bytes)
encoding:NSUTF8StringEncoding];
NSLog(@"%@", helloworld);
出力:
lleHW ,odlro!