Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zachsilvey

macrumors 6502
Original poster
Feb 5, 2008
444
3
Battle Ground
Code:
NSLog(@"%@", book);
NSLog(@"%@", [completeBooksDictionary objectForKey:book]);
[selectedBooksDictionary setObject:[completeBooksDictionary objectForKey:book] forKey:book];

So the first two line demonstrate that those messages do in fact return objects (the first a string constant and the second a dictionary).

Why is that when I use the third line to add the key-value pair it doesn't work?

If I add the entry then use

Code:
NSLog(@"%@", selectedBooksDictionary);

I get Null
 
That doesn't necessarily allocate it, though.

At some point you have to call something like:

Code:
NSMutableDictionary *selectedBooksDictionary = [[NSMutableDictionary alloc] init];

Or something like that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.