views:

67

answers:

1

Hi there

How can I display these bytes in NSLog?

const void *devTokenBytes = [devToken bytes];

Cheers Cyril

+1  A: 

Assuming that devToken is of type NSData * (from the bytes call), you can use the description method on NSData to get a string containing the hexadecimal representation of the data's bytes. See the NSData class reference.

NSLog(@"bytes in hex: %@", [devToken description]);
Tim
but now im getting the error message "warning: passing argument 1 of 'NSLog' from incompatible pointer type"
gabac
Because there's an error in the above code. He left off the @ infront of the string literal. i.e., NSLog("...") instead of NSLog(@"...").
jer
sry was too stupid to see that. thx for the help!
gabac
jer, Chuck: thanks for pointing out and fixing, respectively. Too much C for me lately...
Tim