I'm getting a weird EXC_BAD_INSTRUCTION
crash when I'm using dispatch_group_t
. I'm using MagicalRecord
and my success block gets triggered after a MagicalRecord
save. My dispatch_group_leave(group)
line crashes if there are no changes to save - otherwise it works fine. I have several of these similar calls that are a part of the group, and I'm experiencing the same issue with all of them. I'm totally lost...any ideas?
Below is my code:
// Create a group that will wait until all the profile elements have been update before hiding the activity indicator
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
[self.user readProfileWithContext:self.backgroundMOC
success:^{
dispatch_async(dispatch_get_main_queue(), ^{
[self.view setPreferencesForUser:self.user];
});
// I get the crash on this line when Magical Record doesn't have any changes
dispatch_group_leave(group);
} failure:^(NSError *error) {
dispatch_group_leave(group);
}];
Edit
I don't get any output in the console, but I do get this as the issue in the backtrace (not sure if this is helpful):