mutating method sent to immutable object

后端 未结 4 1522
走了就别回头了
走了就别回头了 2021-02-05 14:54

When I use this method first time it works fine, but when I called it second time I get the error \"mutating method sent to immutable object\". The problem is at line with \"add

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 15:20

    placesT is a non mutable array, either always set placesT a mutable object always or use following code.

    NSMutableArray *placesT= [[[NSUserDefaults standardUserDefaults] objectForKey:@"placesT"] mutableCopy];
    

提交回复
热议问题