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

Stuck

Keep getting this error message There is a compiler error. Please click on preview to view your syntax errors! This is my Code UITabBarItem *tab = [self.selectedIndex.tabBarItems];

What Challenge is this for?

1 Answer

The challenge states The tabs are stored in an array named tabBarItems (line 9). Declare a UITabBarItem variable named tab and set it from tabBarItems using the selectedIndex property.

this is what you have

UITabBarItem *tab = [self.selectedIndex.tabBarItems];

that wont work because your selectedIndex property doesnt have a property tabBarItems. The tabBarItems array is already declared for you on line 9. you need to set your UITabBarItem *tab to an index of this array (your selectedIndex).

Here is a hint: I can set my tab to the first index of my tabBarItems array like so:

UITabBarItem *tab = [tabBarItems objectAtIndex:0];

in your case you need to set it to the selectedIndex, not the first index.