NSMutableDictionary: mutating method sent to immutable object

前端 未结 6 2162
栀梦
栀梦 2021-01-11 10:24

The following code is returning an exception with the following error message \"mutating method sent to immutable object\" when attempting to removeObjectForKey



        
6条回答
  •  误落风尘
    2021-01-11 11:03

    NSUserDefaults returns immutable objects, even if you put in mutable ones. You must call -mutableCopy on the returned value to get a mutable collection.

提交回复
热议问题