First your error: it is telling you that cannot take a pointer to something which isn't an Objective-C object - you have a pointer to UInt8
- simply cast it to a pointer to an Objective-C object - NSData
in your case as ARC (the Objective-C memory collector) doesn't know how to treat the result. You address this, if possible, with a bridge cast which tells ARC how to handle it. However in your case its not possible as you can't just cast an UInt8 *
to an NSData *
- the two refer to totally different things.
At a guess your method is passed a pointer to a sequence of bytes (hasByteArrays:
) and the number of bytes in the sequence (numberOfItems
), if that is correct then the method you are after is initWithBytes:length:encoding:
, this method directly takes a pointer to a byte sequence. E.g.:
NSString *log = [[NSString alloc] initWithBytes:data
length:numberOfItems
encoding:NSASCIIStringEncoding];