Reputation:
My warning in Xcode :
Incompatible pointer types initializing 'NSMutableDictionary *' with an expression of type 'NSDictionary *'
For this code :
NSMutableDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithLongLong:byteCount],@"bytes",
[NSNumber numberWithLong:fileCount],@"files",nil];
[dict writeToFile:countsPath atomically:YES];
Thank you in advance for your help
Upvotes: 0
Views: 7264
Reputation: 179
I also made a mistake like this:
NSMutableDictionary *data = @{ @"value" : value, @"contentArray" : arrayData };
Its very tempting to make this problem. :D
Upvotes: 1
Reputation: 4767
NSMutableDictionary is a subclass of NSDictionary and you are trying the vice-versa.
Upvotes: 0
Reputation: 3459
change this word:
NSMutableDictionary
to
NSDictionary
and fix all errors it will cause
Upvotes: 5
Reputation: 7639
You cannot initialize an NSMutableDictionary
to be [NSDictionary ....
You can, however, assign an NSMutableDictionary
to an NSDictionary
after they have been created and initialized. The reason is because NSMutableDictionary
is a subclass of NSDictionary
, so it can be assigned that way, but not the other way around.
Upvotes: 1