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 trialAlex Danner
4,107 Pointsno visible @interface for 'NSMutableDictionary' declares the selector 'addEntriesFromDictionary'
I am trying to enter the body of the 'addMenuChoice' method in the CateringOrder class but when I try to enter this line of code: [self.orderFormDict addEntriesFromDictionary:@{menuItem.itemName:@0}];
It gives me the error: "no visible @interface for 'NSMutableDictionary' declares the selector 'addEntriesFromDictionary'"
I double checked my code to make sure I entered it like you did, but can't seem to figure out what is causing.
Please help!
2 Answers
Ryan Jin
15,337 PointsI think you have to initialize it first. Like
NSMutableDictionary *orderFormDict = [[NSMutableDictionary alloc] init];
// In another method
[self.orderFormDict addEntriesFromDictionary:@{menuItem.itemName:@0}];
Aleksandrs Muravjovs
1,734 PointsI also had the same issue but finally I noticed that I mistyped in CeteringOrder.h in properties I typed @property (nonatomic, strong) NSMutableArray* orderFormDict; instead of @property (nonatomic, strong) NSMutableDictionary* orderFormDict that is why there was no visible interface in my case.
Always check Your code for mistypings, because sometimes I am spending hours searching for a complex solutions to my issue and finally the mistake is simply mistyping.
Hope that helps.
Happy coding!