Getting an NSException error. Looked around and it may be how I am calling the method but can't troubleshoot it, I'm a beginner so a good explanation is very much appreciated.
Here is my AddListingViewController.h
#import <UIKit/UIKit.h>
#import "ListingTableViewController.h"
#import "ListingManager.h"
@interface AddListingViewController : UIViewController
@property (nonatomic) ListingTableViewController *manager;
@property (nonatomic) ListingManager *add;
@end
Here is my AddListingViewController.m
#import "AddListingViewController.h"
@interface AddListingViewController ()
@property (weak, nonatomic) IBOutlet UITextField *title;
@property (weak, nonatomic) IBOutlet UITextView *desc;
@property (weak, nonatomic) IBOutlet UITextField *price;
@end
@implementation AddListingViewController
@synthesize manager = _manager;
@synthesize add = _add;
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.manager = [[ListingTableViewController alloc] init];
self.add = [[ListingManager alloc] init];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//cancel posting on tap
- (IBAction)cancelListing:(UIBarButtonItem *)sender {
NSLog(@"cancel tapped thpugh");
[self dismissViewControllerAnimated:YES completion:nil];
}
//add item on tap
- (IBAction)addListing:(UIBarButtonItem *)sender {
NSLog(@"Add button tapped");
self.add.listingTitle = self.title.text;
self.add.listingDescription = self.desc.text;
self.add.listingPrice = self.price.text;
[self.manager.listings addObject:self.add];
[self dismissViewControllerAnimated:YES completion:nil];
}
@end
The error I am getting (I'm sure it says is clearly here but I don't know how to troubleshoot it)
2014-06-30 21:37:44.825 Wildcat Exchange[1981:180450] Add button tapped
2014-06-30 21:37:44.827 Wildcat Exchange[1981:180450] -[UITextInputTraits text]: unrecognized selector sent to instance 0xc193e90
2014-06-30 21:37:44.831 Wildcat Exchange[1981:180450] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextInputTraits text]: unrecognized selector sent to instance 0xc193e90'