I'm working with AsyncSocket where the the AsyncSocket object calls a delegate method below whenever it receives data from remote end:
- (void)onSocket:(AsyncSocket*)socket didReadData:(NSData*)data withTag:(long)tag;
Now, within this method, I pass the NSData object into the following command to get a NSString representation of the data received:
NSString *body = [NSString stringWithCString:[data bytes] length:[data length];
Does NSString stringWithCString: length: retain the byte array I pass in? Do I need to retain the NSData *data? Do I need to be releasing NSString *body at the end?
Thanks. I want to get memory management right in terms of delegates methods...