9
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NSData の中身を見るには。

Posted at

NSDataの中身を見ようとNSLogをしても人には理解し難いものなので、

そういうときはこれ。

// NSData *data
unsigned long long size = 50 * 1024;
const unsigned char *ptr = [data bytes];
unsigned char s[size];
for (long long i = 0L, n = [data length]; i < n; ++i)
{
    unsigned char c = *ptr++;
    s[i] = c;
    NSLog(@"char=%c hex=%x", c, c);
}
NSLog(@"%s", s);
9
11
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?