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

Jamie Baker
Jamie Baker
5,703 Points

Hi guys, I'm getting the error "Called object type 'NSDictionary' is not a function or function pointer".

this is my code...

     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 Bijlani", @"author", nil];

         NSDictionary *blogPost3 =

[NSDictionary dictionaryWithObjectsAndKeys:@"An interview with Shaye Howe",@"title", @"Joe Villanueva", @"author", nil];

      self.blogPosts = [NSArray arrayWithObjects:blogPost1,blogPost2,blogPost3 nil]; 

its producing the error aforementioned and I don't understand why. Help welcomed :) Jamie

2 Answers

Stone Preston
Stone Preston
42,016 Points

you are missing a comma after your last blog post in your array. try fixing that

  self.blogPosts = [NSArray arrayWithObjects:blogPost1,blogPost2,blogPost3, nil];
Jamie Baker
Jamie Baker
5,703 Points

good point!

but now when I try run my application it's taking me to my debug navigator and highlighting the

self.blogPosts = [NSArray arrayWithObjects:blogPost1,blogPost2,blogPost3, nil];

as a breakpoint causing an error. in the debug area it lists blogPosts 1-3 like so....

blogPost1 = (NSDictionaryl *) 2 key value / pairs

confused!!!