trouble with images

167 Views Asked by At

I am having a problem during run-time that says

-[__NSCFString _isResizable]: unrecognized selector sent to instance 0x6a86a80 2012-10-24 14:21:08.070 Diabetic Food Guide[767:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString _isResizable]: unrecognized selector sent to instance 0x6a86a80'

I think the problem lies in these parts of the code:

/*ViewControllerManual.m*/
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    NSDictionary* tier = (NSDictionary*)sender;
    if ([segue.identifier isEqualToString:@"loopbackSegue"]) {
        ViewControllerManual* nextController = segue.destinationViewController;
        nextController.items = [tier objectForKey:@"items"];
        nextController.title = [tier objectForKey:@"name"];
    } else if ([segue.identifier isEqualToString:@"detailSegue"]) {
        DetailsController* nextController = segue.destinationViewController;
        nextController.name = [tier objectForKey:@"name"];
        nextController.foodPicture = [tier objectForKey:@"foodPicture"];
        nextController.tablePicture = [tier objectForKey:@"tablePicture"];
    }
}

/*DetailsController.m*/

- (void)viewDidLoad {
    [super viewDidLoad];
    nameLbl.text = self.name;
    foodPic.image = self.foodPicture;
    tablePic.image = self.tablePicture;
    }

foodPic and tablePic are both UIImageViews, and foodPic is set using cell.imageView.image = [UIImage imageNamed:[[self.items objectAtIndex:indexPath.row] objectForKey:@"foodPicture"]]; which calls from an array that contains the paths to the images. The error only occurs when loading a view of the class DetailsController. If I need to supply more info, please don't hesitate to tell me.

1

There are 1 best solutions below

0
MANIAK_dobrii On

Seems you're returning NSStrings here:

nextController.foodPicture = [tier objectForKey:@"foodPicture"];
nextController.tablePicture = [tier objectForKey:@"tablePicture"];

And then

// UIImage* = NSString*
nextController.foodPicture = [tier objectForKey:@"foodPicture"];
nextController.tablePicture = [tier objectForKey:@"tablePicture"];

Or you've over released something. But from your description it's more likely the issue with assigning NSString to an UIImage.