How to solve runtime error [__NSCFString _isResizable]: unrecognized selector sent to instance?

I'm starting an iphone, a Terminating application runtime error occurs in my code due to the unselected exception 'NSInvalidArgumentException', reason: '- [__ NSCFString _isResizable]: unrecognized selector sent to instance 0x6e6e300'

my code

- (void)viewDidLoad
{
    [super viewDidLoad];
     NSString *path=[[NSBundle mainBundle] pathForResource:@"Animalfile" ofType:@"plist"];
    NSDictionary *dict=[NSDictionary dictionaryWithContentsOfFile:path];
    NSArray *animal=[dict valueForKey:@"image"];
    NSLog(@"print:%@",dict);
    NSLog(@"hello:%@",animal);

    UIImage *img=[animal objectAtIndex:currentImage];
        [animalphoto setImage:img];

}

indicate any sentence and source code that is used in my code ....

+5
source share
1 answer

The problem occurs when you try to process a string as an image:

UIImage *img = [animal objectAtIndex:currentImage];

animal , dict, , dictionaryWithContentsOfFile:. NSString, NSData, NSDate, NSNumber, NSArray NSDictionary. UIImage , dictionaryWithContentsOfFile:, .

NSString UIImage. , , : , , URL, , . , , img . ,

UIImage *img = [UIImage imageNamed:[animal objectAtIndex:currentImage]];

, .

+11

All Articles