I keep getting the error:
NSInvalidArgumentException ', reason:' - [UIViewController setPhotoCellName:]: unrecognized selector sent to the instance
when I get into my preparation for calling segue. I am currently
TabBarController-> NavigationController-> TableViewController-> TableViewController-> ViewController
with a UI image on it.
The problem occurs when I try to switch from a second TableView controller to a ViewController. I have a segue setting from a Prototype cell for the actual ViewController. He enters the sedge and falls. I am trying to pass an NSArray property to a NSArray in viewController to be able to use the url in it and display a UIImage . PhotoInPlace contains an array that I am trying to transfer. Here is the code.
myTableViewControllerPhotoLocation.m Code
#import "myTableViewControllerPhotoLocation.h" #import "FlickrImageViewController.h" @interface myTableViewControllerPhotoLocation () @end @implementation myTableViewControllerPhotoLocation @synthesize photoInPlace = _photoInPlace; //Contains NSArray to pass -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if([segue.identifier isEqualToString:@"Photo Display"]){ NSIndexPath* indexPath = [self.tableView indexPathForCell:sender]; NSLog(@" Dicitonary = %@", [self.photoInPlace objectAtIndex:indexPath.row]); //Returns the picked cell NSLog(@"%@", [self.photoInPlace class]); //returns NSArray NSLog(@"%@", [self photoInPlace]); //Returns the array [segue.destinationViewController setPhotoCellName:[self.photoInPlace objectAtIndex:indexPath.row]]; //Crashes HERE! } }
Code FlickrImageViewController.h
@property (nonatomic, strong) NSArray* photoCellName;
FlickrImageViewController.m Code
source share