将图像添加到imageView iOS时出现NSInvalidArgumentException异常

将图像添加到imageView iOS时出现NSInvalidArgumentException异常,ios,iphone,objective-c,ipad,Ios,Iphone,Objective C,Ipad,.H文件 @property (strong, nonatomic) LAClaimReport *claimReport; .M文件 @interface LACreateReportViewController () { NSArray *_thumbnails; LAPhotoThumb *_lastSelectedPhoto; } _thumbnails = _claimReport.photos.allObjects; if (_thumbnails.cou

.H文件

@property (strong, nonatomic) LAClaimReport *claimReport;
.M文件

@interface LACreateReportViewController ()
{
    NSArray *_thumbnails;
    LAPhotoThumb *_lastSelectedPhoto;
}

_thumbnails = _claimReport.photos.allObjects;
    if (_thumbnails.count >0)
    {
        _photosCaption.textColor = [UIColor colorWithRed:0/255.0 green:46/255.0 blue:91/255.0 alpha:1];

        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(30, 1838, 300, 600)];
         NSLog(@"image:%@" , _thumbnails[0]);
        [image setImage:(UIImage *) _thumbnails[0]]; // exception here.

}
NSInvalidArgumentException',原因:'-[LAPhoto size]:未识别的选择器发送到实例0xa76b720'


照片是
LAClaimReport
类文件中的一列。在尺寸方面,我遗漏了什么?请参考。

\u缩略图
不包含
UIImage
实例,它包含其他类型的对象。但是,没有包含足够的信息来说明它包含什么类型的对象

size
是图像视图使用的
UIImage
上的一种方法,用于确定如何显示图像,而
\u缩略图中的任何对象都不会实现该方法


您的
NSLog(@“image:%@,_缩略图[0])
应该列出您试图用作图像的类类型。

确保在“缩略图”数组中有UIImage类对象,我认为在该数组中有LAPhoto类型的对象

id arrContent=_thumbnails[0];
    if ([arrContent isKindOfClass:[LAPhoto Class]])
    {
        //read LAPhoto class and find a way to get the UIImage from LAPhoto Object
    }
    else if ([arrContent isKindOfClass:[UIImage class]])
    {
        [image setImage:(UIImage *) _thumbnails[0]];
    }

确保在_缩略图数组中有UIImage类对象,我认为在该数组中有LAPhoto类型的对象array@Pandey_LaxmanUIImageView*image=[[UIImageView alloc]initWithFrame:CGRectMake(301838300600)];NSLog(@“image:%@,_缩略图[0]);UIImage*images=[[UIImage alloc]initWithData:_缩略图[0]];[图像设置图像:图像];这样好吗?