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
Michael Dennison
710 PointsBlogReader Xcode Problem
Hi I've just started this program and I am having a issue right off the bat
This is the code
<code> [super viewDidLoad];
self.titlesArray = [NSArray arrayWithObject:
@"Getting started with WordPress",
(!) @"Whitespace in Web Design: What It Is and Why you Should Use It",
@"Adaptive Images and Responsive SVGs - Treehouse Show Episode 15",
@"Productivity is About Constraints and Concentration",
@"A Guide to Becoming the Smartest Developer on the Planet",
@"Teacher Spotlight: Zac Gordon",
@"Do You Love What You Do",
@"Applying Normalize.css Reset - Quick Tip",
@"How I Wrote a Book in 3 Days",
@"Responsive Techniques, JavaScript MVC Frameworks, Firefox 16 Treehouse Show Episode 14", nil];
</Code>
where I inserted the (!) I am getting (Too many arguments to method call, expected 1, have 11)
Can someone help me with this
Thanks Mike
5 Answers
Pavel Palancica
6,535 PointsHey Michael,
From the name of the method you call, it's pretty obvious you should only provide ONE argument, like this:
[NSMutableArray arrayWithObject:@"Getting started with WordPress"];
If you want to initialize the array with more than one object, write code like this:
[NSMutableArray arrayWithObjects:@"string_1", @"string_2", @"last_string", nil];
DO NOT FORGET to ADD the "nil" at the end :).
Hope it helped you
Michael Dennison
710 PointsHi @Pavel
I changed it to the way you where saying so now it looks like this
<Code> self.titlesArray = [NSArray arrayWithObject:@"Getting started with WordPress", @"Whitespace in Web Design: What It Is and Why you Should Use It", @"Adaptive Images and Responsive SVGs - Treehouse Show Episode 15", @"Productivity is About Constraints and Concentration", @"A Guide to Becoming the Smartest Developer on the Planet", @"Teacher Spotlight: Zac Gordon", @"Do You Love What You Do", @"Applying Normalize.css Reset - Quick Tip", @"How I Wrote a Book in 3 Days", @"Responsive Techniques, JavaScript MVC Frameworks, Firefox 16 Treehouse Show Episode 14", nil]; </Code>
But same error.. I have no other (!) anywhere else just in that one spot.
Pavel Palancica
6,535 PointsMike, you should be MORE CAREFUL, it is "arrayWithObjects", not "arrayWithObject".
And I'm telling you the SECOND TIME, everything is PRETTY OBVIOUS from the name of the method :).
Hope you'll get it working now
Michael Dennison
710 PointsPavel
Thanks for the help.. I feel like an idiot I've been staring at that and watching the video over and over again today and I didn't even see that I missed that "s"
thanks for the help Mike
Ernest Grzybowski
Treehouse Project ReviewerGlad to see you got it working Michael. Rookie mistake. Hahaha, but now I'm sure you'll never make that mistake again.