I'm trying to use the dictionary function... some sites have told me to review my storyboard but I haven't created one..?

NSMutableDictionary * AllStudentsUpdated = [[NSDictionary alloc]initWithObjectsAndKeys:
                                      @"Avni Parikh", @"012700",
                                      @"Kyle Kurt", @"325325",
                                      @"Vidhi Shah", @"122146"
                                      , nil];
[AllStudentsUpdated setObject:@"Pallavi Patel" forKey:@"161616"];// this is where the error is 
1

There are 1 best solutions below

1
Mohit Kumar On

You are initializing NSMutableDictionary with NSDictionary... just update your code to this.

NSMutableDictionary *AllStudentsUpdated = [[NSMutableDictionary alloc] initWithObjectsAndKeys: @"Avni Parikh", @"012700", @"Kyle Kurt", @"325325", @"Vidhi Shah", @"122146" , nil];

[AllStudentsUpdated setObject:@"Pallavi Patel" forKey:@"161616"];

Clean your build folder and run your app. That will solve your problem.