I’m trying to create a sectioned table. I’ve got two parsed NSMutableArrays feedsTopics and feedsSchools who reside in my mainAppDelegate.
In my tableViewController, I create an appDelegate representing my app’s delegate:
appDelegate = (mainAppDelegate *)[[UIApplication sharedApplication] delegate];
I’m trying to declare topics and schools as arrays like so (which is an ERROR that reads, “No known class method for selector ‘appDelegate'”, just saying that’s what I’ve gotten to):
NSArray *topics = [[NSArray appDelegate] feedsTopics];
which I want to add as a dictionary object to NSMutableArray listOfItems like so (this has an error saying it “expects an identifier”):
NSDictionary *topicsDict = [NSDictionary dictionaryWithObject:appDelegate.feedsTopics forKey:[@"News by Topic"];
What am I doing wrong here?
The first error is caused by calling a
appDelegatemethod ofNSArray– this does not exist. The second error is caused by a misplaced[.Your code should look like this:
and
By the way: Your errors do not relate to tableViews at all. I’d suggest to edit the title of this question.