Initializing NSMutableArray __strong with an incompatible type of void

iphone, nsjsonserialization, nsmutablearray

Solution

"Holy run-on expression, Batman!"

If you were to separate that out into multiple lines, you could easily see where the problem is.

Or, more likely, the error would mysteriously go away.

The problem is that `addObject:` returns `(void)`, but you are trying to assign the return value of that method to the variable.

Problem

This is what is returning the error: ``` NSMutableArray *newArray = [[[NSMutableArray alloc] initWithArray:[NSJSONSerialization JSONObjectWithData:[[[appDelegate.Matches objectAtIndex:(NSUInteger)indexPath] objectForKey:@"chat"] dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil]] addObject:[NSDictionary dictionaryWithObjectsAndKeys:message, @"message", [NSString stringWithFormat:@"%llu", appDelegate.userId], @"id", nil]]; ```

Original source