Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

What is NSDictionary

Hi guys,

Trying to do this part of the course with Amit, when i run my blog reader program i get this error:

Thread 1 signal SIGABRT 2014-06-02 23:25:01.188 Blog Reader[649:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSDictionary dictionaryWithObjectsAndKeys:]: second object of each pair must be non-nil. Or, did you forget to nil-terminate your parameter list?' *** First throw call stack:

I've compared code and seems the same as the video...

Any idea what im doing wrong?

2 Answers

Stone Preston
Stone Preston
42,016 Points

can you post the code you are using where you create an NSDictionary?

```- (void)viewDidLoad { [super viewDidLoad];

NSDictionary *blogPost1 = [NSDictionary dictionaryWithObjectsAndKeys:@"The Missing Widget in Android", @"title", @"Ben Jakuben", @"author", nil];
NSDictionary *blogPost2 = [NSDictionary dictionaryWithObjectsAndKeys:@"Getting Started with iOS Development", @"title",@"Amit Bijhlani", @"author", nil];
NSDictionary *blogPost3 = [NSDictionary dictionaryWithObjectsAndKeys:@"An Interview With Shay Howe", @"title" @"Joe Villanueva", @"author", nil];
self.blogPosts = [NSArray arrayWithObjects:blogPost1,blogPost2, blogPost3, nil];

}

and

 ```{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    NSDictionary *blogPost = [self.blogPosts objectAtIndex:indexPath.row];

    cell.textLabel.text = [blogPost valueForKey:@"title"];

    return cell;
}```