Reputation: 13
I am just learning objective-c but can't figure out whats wrong with my code
Code:
NSMutableDictionary *myDic = [NSDictionary dictionary];
[myDic setObject:[NSURL URLWithString:@"http://www.apple.com"] forKey:@"Apple"];
Upvotes: 0
Views: 406
Reputation: 49335
Although you're declaring NSMutableDictionary
you're creating immutable NSDictionary
object.
The correct declaration and initialization of myDic
would be
NSMutableDictionary *myDic = [NSMutableDictionary dictionary];
Upvotes: 3