Q:

EXC_BAD_ACCESS when changing bool value in nsdictionary

I have an array of nsdictionaries, each dictionary has a boolean value, I want to change boolean value when user selects the row.  
But somehow I get exc_bad_access. 
This is how setup array of dictionaries:
self.choosedfiles=[[NSMutableArray alloc] init];
for (NSString *s in fileListINDoc){
        NSArray *partialDates =[s componentsSeparatedByString:@". "];//split string where - chars are found
        NSFileManager* fm = [NSFileManager defaultManager];
        NSDictionary* attrs = [fm attributesOfItemAtPath:[dataPath stringByAppendingPathComponent:s] error:nil];
        NSDate *dateLocal =(NSDate*)[attrs objectForKey: NSFileModificationDate];

        //creatre unique name for image _AKIAIVLFQKMSRN5JLZJA
        NSString *uniqueFileName=[NSString stringWithFormat:@"%@_AKIAIVLFQKMSRN5JLZJA_%@.jpeg",[partialDates objectAtIndex: 0],[partialDates objectAtIndex: 1]];

        BOOL isFileChoosen=NO;

        NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                                dateLocal,@"date",uniqueFileName,@"imagename",s,@"name",isFileChoosen,@"isFileChoosen",
                                nil];
        [tempArray addObject:params];
    }
    NSSortDescriptor *descriptor=[[NSSortDescriptor alloc] initWithKey:@"date" ascending:NO];
    NSArray *descriptors=[NSArray arrayWithObject: descriptor];
    NSArray *reverseOrder=[tempArray sortedArrayUsingDescriptors:descriptors];

    self.files=[[NSMutableArray alloc] initWithArray:reverseOrder];

This causes the error when I try to change the boolean value, XCODE shows line *params dictionary as the error:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   NSDictionary *currentArticle = [self.files objectAtIndex:indexPath.row];
   NSNumber* ischoosenObject =[currentArticle objectForKey:@"isFileChoosen"];
    if ([ischoosenObject boolValue]==NO) {
        BOOL isFileChoosen=YES;
        NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:[currentArticle objectForKey:@"date"],@"date",[currentArticle objectForKey:@"imagename"],@"imagename",[currentArticle objectForKey:@"name"],@"name",isFileChoosen,@"isFileChoosen",nil];
        [self.files replaceObjectAtIndex:indexPath.row withObject:params];
        [self.choosedfiles addObject:[currentArticle objectForKey:@"name"]];

    }
}

What could be the problem in above code?  
Thanks,
Space

A:

Objective-C collection classes can only hold objects, not primitive types, so change:
BOOL isFileChoosen=YES;

To:
NSNumber *isFileChosen = [NSNumber numberWithBool:YES];

in order to effectively wrap your boolean in an object. 
(This will, of course, have some implications on other parts of your code).