I have used NSMutable Dictionary and NSMutable Array. The datas are to be stored and retrieved from plist(Documents Directory) using NSArray of NSMutable Dictionary.
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArray removeObjectAtIndex:]: mutating method sent to immutable object'
Please Guide me why its happened?.
Thanks!
It might help if you post the exact code that causes. My guess would be that while you are using
NSMutableDictionary, the call tovalueForKey:returns to you a non-mutableNSArray, and you think it is returning you anNSMutableArrayinstance. Note that mutable arrays and dictionaries allow you to manipulate the collection of items inside them, but do not guarantee you that those items themselves are mutable. For example, if you check the Property List Programming Guide: Reading and Writing Property-List Data, you will notice the following example:If you need explicit control over the mutability of the objects at each level, use
propertyListFromData:mutabilityOption:format:errorDescription:You can also create an explicit
NSMutableArraycopy from theNSArrayyou got from theNSMutableDictionary.