I have an NSMutableArray that contains a list of objects of type “MyClass”, with each object having a parameter called, “name” that is of type “NSString”. I need to display this list in a TableView, and in my “cellForRowAtIndexPath” method, I have the following line:
cell.textLabel.text = [[SingletonClass sharedInstance].myArray objectAtIndex:[indexPath row]].name;
Here, SingletonClass is my DataLayer, and myArray is the NSMutableArray that contains the list of objects. I am getting the error: “Property ‘name” not found on object of type ‘id'”, so I need to figure out how to correctly cast to “MyClass”, and retrieve its “name” parameter so that it can be displayed in the table.
If you want ugly code:
If you want a bit more readable code, use a message send-style call instead: