hi_Matt
hi_Matt

Reputation: 159

xcode error: No visible @interface for masterViewController declares the selector

I am having what seems to be a fairly common problem but I cannot figure out what is wrong with my code specifically.

I have scoured stackoverflow and read at least a dozen posts that are similar to mine, but I cannot figure out my personal problem.

Basically, I am trying to pass the NSMutableDictionary from the modal view to the master view. Here's the code:

QuoteMasterViewController.h:

    @class QuoteModalViewController;
    @interface QuoteMasterViewController : UITableViewController
    @end

QuoteMasterViewController.m:

#import "QuoteMasterViewController.h"
#import "QuoteModalViewController.h"
#import "QuoteDetailViewController.h"

@interface QuoteMasterViewController () {
    NSMutableArray *_objects;
    }
@end

@implementation QuoteMasterViewController

//after the ViewDidLoad method...

-(void)addQuotationWithDictionary: (NSMutableDictionary *)myDictionary {

     [self insertNewObject:myDictionary];
     [self dismissModalViewControllerAnimated:YES];
 }

QuoteModalViewController.h:

 #import <UIKit/UIKit.h>

 @class QuoteMasterViewController;

 @interface QuoteModalViewController : UIViewController <UITextFieldDelegate>

 @property (nonatomic, weak) QuoteMasterViewController *masterView;
 @property (strong, nonatomic) IBOutlet UITextField *sourceQuoted;
 @property (strong, nonatomic) IBOutlet UITextField *quoteQuoted;
 - (IBAction)saveButtonPressed:(id)sender;
 - (IBAction)cancelButtonPressed:(id)sender;

 @end

QuoteModalViewController.m:

#import "QuoteModalViewController.h"
#import "QuoteMasterViewController.h"

@interface QuoteModalViewController ()

@end

@implementation QuoteModalViewController

@synthesize sourceQuoted;
@synthesize quoteQuoted;
@synthesize masterView;


//After ViewDidLoad
- (IBAction)saveButtonPressed:(id)sender {
    if (![sourceQuoted.text isEqualToString:@""] && ![quoteQuoted.text isEqualToString:@""]) {
        NSString *sourceString = sourceQuoted.text;
        NSString *quoteString = quoteQuoted.text;
        NSMutableDictionary *quotesDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys: sourceString, @"Source", quoteString, @"Quote", nil];
        [masterView addQuotationWithDictionary:quotesDict]; //Error occurs here
        NSLog(@"%@", quotesDict);
    }
}

Thank you in advance for any and all help!

Upvotes: 3

Views: 10495

Answers (1)

Kreiri
Kreiri

Reputation: 7850

You didn't declare your method in header file. Add

-(void)addQuotationWithDictionary: (NSMutableDictionary *)myDictionary;

to QuoteMasterViewController.h file between @interface QuoteMasterViewController and @end.

Upvotes: 7

Related Questions