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 Build a Simple iPhone App (iOS7) Refactoring into a Model Understanding @property

Christopher Dyer
Christopher Dyer
3,634 Points

In xcode6 beta, "_predictions" is an undeclared identifier, while self.predictions is ok. Could you please consider why?

I am still programming objective-c, and everything else works essentially the same. Of course, I may be making a mistake somewhere. Hopefully you can illuminate what is going on. THanks.

1 Answer

David Anton
PLUS
David Anton
Courses Plus Student 30,936 Points

Hey Christopher Dyer,

Try to write this code in the .m file. If you declared a property in the .h file, you should synthesize with the .m file.

Example .h file: @interface FVTabSettingsViewController : UIViewController @property (strong, nonatomic) IBOutlet UIButton *DBButton;

Example .m file: @interface FVTabSettingsViewController () @end @implementation FVTabSettingsViewController{} @synthesize DBButton =_ DBButton;

Christopher Dyer
Christopher Dyer
3,634 Points

Thanks David. You are right, this works, but I'm not sure why @synthesize also resolves the errors. If I might clarify my original questions - I'd like to know when to use _ self. or synthesize or does it just not matter?