Reputation: 33080
-(NSArray *) convertArrayOfDictionaryToOneOfItsElement: (NSString *) key
{
NSArray * result = [self convertEachElementToAnother:^(id element){
NSDictionary *elementDictionary = (NSDictionary *) element;
NSString * value= elementDictionary [key];
//NSAssert(result, @"result must not benil");
return value;
}];
return result;
}
This code works fine without NSAssert. However, if things are nil I want to ensure I nkow when it happens.
Well, I put NSAssert
It hangs.
exc_bad_access
Why?
Update: I found the bug. It should be NSAssert (value, @"result must not benil")
Well, I still want to know why doing NSAssert (result,...
cuases problem
Upvotes: 0
Views: 80
Reputation: 520
Because inside block you have no result array, this array will assign only after last block execute.
Upvotes: 3