I try to dynamically add objects to a NSArray. 0 error appears in XCode.
However, the IOS simulator generates errors and closes.
The static version of my code works fine.
So I do not understand where does the error.
Static version :
  candyArray = [NSArray arrayWithObjects:
              [Candy candyOfCategory:@"chocolate" name:@"chocolate bar"],
              [Candy candyOfCategory:@"chocolate" name:@"chocolate chip"],
              [Candy candyOfCategory:@"chocolate" name:@"dark chocolate"],
              [Candy candyOfCategory:@"hard" name:@"lollipop"],
              [Candy candyOfCategory:@"hard" name:@"candy cane"],
              [Candy candyOfCategory:@"hard" name:@"jaw breaker"],
              [Candy candyOfCategory:@"other" name:@"caramel"],
              [Candy candyOfCategory:@"other" name:@"sour chew"],
              [Candy candyOfCategory:@"other" name:@"peanut butter cup"],
              [Candy candyOfCategory:@"other" name:@"gummi bear"], nil];
Dynamic version :
   // get JSON data from URL
   NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http:///?view=json"]];
NSURLResponse *resp = nil;
NSError *error = nil;
NSData *response = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &resp error: &error];
NSString *jsonString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; //your json string from URL request
// PARSINF JSON VALUE
NSDictionary *jsonDictionary = [jsonString JSONValue];
NSDictionary *players = [jsonDictionary objectForKey:@"user"];
// Creating mutablearray who will receive the inputs of json:
NSMutableArray *nameInsert = [[NSMutableArray alloc] init];
for (NSDictionary *player in players)
{
    NSString *item = [player objectForKey:@"name"];
    [nameInsert addObject: [Candy candyOfCategory:@"chocolate" name:item" ]];
}
candyArray = nameInsert;
If the loop contains nothing IOS simulator works.
Of course, nothing is present in the application.