I'm turning on ARC for a project (yay) and have run into a problem I can't wrap my head around. It always worked fine before ARC. When I turn zombies on, doing "memory history 0x610004279ac0" can't find it in the history. Here's the method and the call to it:
-(void) doStuff:(NSString**)fillMeIn { [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop) { if(obj.flag) { *stop = YES; *fillMeIn = @"wow"; } }]; } NSString* getFilledIn; [thing doStuff:&getFilledIn]; The call to doStuff: results in EXC_BAD_ACCESS, or "*** -[CFString retain]: message sent to deallocated instance 0x610004279ac0" if I turn zombies on. I tried changing the param type to (NSString** _Nonnull), thinking it was confused about my knowing that the reference will never be nil, but it didn't help. Then I got to thinking about the reference being assigned inside the block and changed it to: -(void) doStuff:(NSString** _Nonnull)fillMeIn { __block NSString* noFillMeIn; [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop) { if(obj.flag) { *stop = YES; *noFillMeIn = @"wow"; } }]; *fillMeIn = noFillMeIn; } That seems to fix it. Is there a better way to deref and assign to the param from within the block? Sent from iCloud's ridiculous UI, so, sorry about the formatting _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com