I have ARC on for my test project, and one of my class has this method:
Here is what I do to call this method:
But data always is nil after the call.
If I turn off ARC for the projec then it works as expected. I want to have ARC on while having this method work. What should I do?
PS: Is this a serious bug? I think when I do *data = ... the object apparently has a reference and should not be released when the method exits.
Code:
- (int) GetData: (NSData**)data
{
uint8_t * p = malloc(10);
for (int i = 0; i < 10; i++) {
p[i] = i + 1;
}
*data = [NSData dataWithBytesNoCopy: p length:10 freeWhenDone:YES];
}
Here is what I do to call this method:
Code:
NSData * data = nil;
[theObject GetData:&data];
But data always is nil after the call.
If I turn off ARC for the projec then it works as expected. I want to have ARC on while having this method work. What should I do?
PS: Is this a serious bug? I think when I do *data = ... the object apparently has a reference and should not be released when the method exits.
Last edited by a moderator: