Xcode doesn't seem to find the properties of a given UITableViewController even though I'm importing it and they seem correctly defined on the class.
I've tried to clean, delete derived data, restart XCode and build again, none of this works. Also have tried to access the property through the setter.
This is my code:
MasterViewController.m
#import "DetailTableViewController.h"
...
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"nextScreen"]) {
DetailTableViewController *detailTableViewController = [segue destinationViewController];
NSInteger tagIndex = [(UIButton *)sender tag];
detailTableViewController.productType = tagIndex;
/*[detailTableViewController setProductType:tagIndex];*/ //This does not work either.
} else if ([[segue identifier] isEqualToString:@"anotherSegue"]){
MyLoginViewController *loginViewController = [segue destinationViewController];
loginViewController.delegate = self; //Funnily enough, this one works
}
}
DetailTableViewController.h #import
@interface DetailTableViewController : UITableViewController<UITableViewDelegate, UITableViewDataSource> {
NSInteger *productType;
}
@property (nonatomic) NSInteger *productType;
@end
DetailTableViewController.m
@implementation DetailTableViewController
@synthesize productType = _productType;
...
edit: The error comes into this line:
detailTableViewController.productType = tagIndex;
Does anyone have an idea about why could this happen? Thanks!
Updated:
Looks like it's something related to how XCode is referencing my files, it's really odd:
When I cmd + click on detailTableViewController (the one where I create my instance) it takes me to my actual code:
detailTableViewController *detailTableViewController = [segue destinationViewController];
But when I cmd + click on the import line, it takes me to some interface with the same name as mine, and same declaration except it does not have any of the properties my code has.
#import "DetailTableViewController.h"
Has anyone gone through the same issue?
Solved!
So basically, I could find that there were two copies on the file within Finder, one on the root folder of my project and another one inside the source folder.
Can't come across why did this happen or whether I duplicated the file without intention, but now it's perfectly working.
Thanks to you all for your answers!