I'm writing an iphone apps that receive data from an udp socket i can dispay what i receive using NSDATA description but is in hex format and for example it look like this:
<4c61742c 34343039 3131302e 35302c4c 6f6e2c39 38343237 3开发者_JS百科52e3934 2c482c32 37392e30 302c4b6e 6f74732c 302e3032 2c4e616d 652c504c 41594552 2c496e64 65782c30 2c4d756c 7469706c 61796572 4e756d62 65722c30 00>
i know that thi is a prase of compite sens how i can convert it ?
NSString * s = [[[NSString alloc] initWithData:yourData encoding:NSUTF8StringEncoding] autorelease];
I'm going to assume you want to just debug the binary data. If that's not the case, what I describe below won't be terribly useful.
One technique I like is to use 0xED. Copy that big binary dump (everything inside the angle brackets) and paste it into a newly created 0xED document. You get a nice hex editor view.
0xED also supports user-defined plugins which can help visualize the binary data (for instance, converting an 8 byte timestamp to an NSDate)
精彩评论