EXC_BAD_ACCESS Application Crash Objective C code = 1

The app crashes on reaching this code

- (void)setUniformsForProgramAtIndex:(NSUInteger)programIndex {
    [uniformStateRestorationBlocks enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
        dispatch_block_t currentBlock = obj;
        // error here is Thread:20 EXC_BAD_ACCESS (code =1, address= 0x579fcea0)
        currentBlock();
    }];
}

Tried so many things but still can't figure out what the error is please help me solve this problem...


Check contents of the dictionary. Looks like obj is released which shouldnt happen since its retained when you add it. Put a breakpoint and check what value you get in obj.