Varun Kumar
Varun Kumar

Reputation: 342

EXC_BAD_ACCESS app 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...

Upvotes: -1

Views: 275

Answers (3)

bugtags.io
bugtags.io

Reputation: 11

Maybe the uniformStateRestorationBlocks have a value that isn't a valid dispatch_block_t object or an object has been released in other place?

In general, the EXC_BAD_ACCESS crash is occurred by accessing a released or invalid pointer.

Upvotes: 1

Igor
Igor

Reputation: 12303

You need make sure, that values in uniformStateRestora‌​‌​tionBlocks is really a blocks.

Upvotes: 0

Kamaldeep
Kamaldeep

Reputation: 11

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.

Upvotes: 1

Related Questions