I know this question has been asked, but none of the answers I saw helped me. If you think I missed one that may help, please let me know. I saw other examples where the view controller simply did not have the variable that was trying to be set, but that is not my case.
I'm getting this error during a segue:
-[EditPropertyViewController setLawnNumber:]: unrecognized selector sent to instance 0x19a301e0
whenever I hit this if block inside of prepareForSegue:
if( [segue.identifier isEqual:@"editProperty"])
{
EditPropertyViewController *destView = segue.destinationViewController;
destView.lawnNumber = _lawnNumber;
destView.latitude = _latitude;
destView.longitude = _longitude;
destView.address = _serviceAddressLabel.text;
}
I do have #import "EditPropertyViewController.h" at the top of my .m file. I do have a segue with identifier "editProperty", and it pushes a view control that is set to type EditPropertyViewController.
Here is EditPropertyViewController.h, showing that I have the variables I'm trying to set:
#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface EditPropertyViewController : UIViewController
@property (nonatomic, strong) GMSMapView *mapView;
@property (nonatomic, strong) GMSCameraPosition *camera;
@property(strong, nonatomic) NSString *address;
@property (nonatomic) CLLocationDegrees latitude;
@property (nonatomic) CLLocationDegrees longitude;
@property (nonatomic) int lawnNumber;
@end
I use this same method with the same variable types and what not to pass data during other segues, but I don't see what I'm doing differently here to cause this problem. I haven't created a [customVC setVariable:] method anywhere else, and haven't run in to this issue yet.
Any advice is appreciated!
Edit - following @David H's advice, I added these two lines before trying to set values:
NSLog(@"Actual class is %@", NSStringFromClass([destView class]));
assert( [destView class] == NSStringFromClass([destView class]));
Which caused the following output:
2015-02-27 16:56:27.623 LawnGuru[2730:460942] Actual class is EditPropertyViewController
Assertion failed: ([destView class] == NSStringFromClass([destView class]))
Copy/pasted from the storyboard, this is the type of the VC I'm trying to segue to: "EditPropertyViewController" and this is the .h file I'm accessing: #import "EditPropertyViewController.h"