Is there any difference between initializing an NSDictionary by this way:
self.myData = [[NSDictionary alloc] init];
[self.myData initWithObjects:objects forKeys:keys];
or this way:
self.myData = [[NSDictionary alloc] initWithObjects:objects forKeys:keys];
Because the reason I'm asking this question is the first one is not working. I'm new and curious to know why?
Here's My Code :-
The first version calls init twice, which is a very, very bad thing to do in most cases, but especially bad for built-in classes like NSDictionary. I have never tried this, but it should crash because you initialised an immutable dictionary, and the second attempt to initialise would modify it.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments