I’m having a big trouble while creating NSDictionaries inside a for-loop while using ARC. The point is that after the first “dict” creation, the app crashes giving an EXC_BAD_ACCESS so I presume it’s something related to the release of the object, but can’t figure out what! I tried using an autoreleasepool but the result was the same
for (int i = 0; i < [arr1 count]; i++) {
__strong NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[arr1 objectAtIndex:i], @"name", [arr4 objectAtIndex:i], @"position", [arr2 objectAtIndex:i], @"number", [arr5 objectAtIndex:i], @"status", [[arr6 objectAtIndex:i] intValue], @"order", nil];
[pl_stuff addObject:dict];
}
thanks for your replies
You’re trying to add plain integer value to your array, but array accept only objective-c objects. You should probably just leave that as: