I had this problem myself. In this case, I think you just need to declare a new strong reference just before the @autoreleasepool
, and set the method argument just after the @autoreleasepool
block from that temporary reference.
- (void)processAThing:(id)thing error:(NSError * __autoreleasing *)error {
__strong NSError *errOut = nil;
@autoreleasepool {
// do your stuff and set errOut instead of error
}
if (error) {
*error = errOut;
}
}
(typed in browser, not error checked by compiler)
As for your premature return, I guess you'll have to use a jump label (even if it's not pretty).