使用不兼容的void类型初始化NSMutableArray __strong

mic*_*ela 2 iphone nsmutablearray nsjsonserialization

这是返回错误的原因:

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]];
Run Code Online (Sandbox Code Playgroud)

bbu*_*bum 13

"神圣的表达,蝙蝠侠!"

如果你要把它分成多行,你可以很容易地看出问题出在哪里.

或者,更可能的是,错误会神秘地消失.

问题是addObject:返回(void),但您尝试将该方法的返回值赋给变量.

  • 为"神圣的继续表达,蝙蝠侠!"+1 ...哦,答案;) (4认同)