When you find an exception in an ObjC @catch
block, what is the life cycle of this exception object? I know that I can safely use it inside a block, but what if I want to use it again after a block, like this?
NSException * exception = nil; @try { // do something risky } @catch(NSException * e) { exception = e; } if (exception) { NSLog(@"Caught exception: %@", exception); }
Is it safe to copy the link to another local one? Should I be retain, autorelease
safe? Can I keep it and keep it on forever?
(It seems to work fine if I assign local or save and use later, but the documents do not discuss where this object βcomesβ from the point of view of ownership or if it is special, so I was looking for more clarity.)
source share