I know this is a stupid question, but I’ve looked for 45 mins now and can’t seem to get it right. I am practicing with methods and have the following method in a delegate class called QuotesAppDelegate.
- (NSArray *) getQuoteMaps: fromSubId:(NSString *)subId {
QuotesAppDelegate *appDelegate = (QuotesAppDelegate *)[[UIApplication sharedApplication] delegate];
self.quotes = [appDelegate quotes];
self.quoteMaps = [appDelegate quoteMaps];
//get the quote_ids from quote_map for this subject_id
NSPredicate *filterSubjectId = [NSPredicate predicateWithFormat:@"subject_id == %@", subId];
NSArray *quoteMapSection = [self.quoteMaps filteredArrayUsingPredicate:filterSubjectId];
NSLog(@"appDelegate getQuoteMaps Count: %i", quoteMapSection.count);
return quoteMapSection;
}
I want to call this from SubjectViewController class here:
NSArray *quoteMapSection = [appDelegate.getQuoteMaps fromSubId:selectedSubject.subject_id];
but get an error on the appDelegate.getQuoteMaps part. I tried it several other ways and am not sure what the right syntax is.
Can someone bail me out here?
Change the function signature to
and then call like this