我有一个应用程序,我从相机捕获图像并将其设置为按钮。
因此,在从相机捕获图像并点击使用按钮后,我的应用程序因 [NSCFType setImage:forstate] 无法识别的实例而崩溃
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImage *resizeImage = [image imageWithImage:image scaledToSize:CGSizeMake(320, 480)];
//convert the selected image to NSData
toShowFullImage = UIImageJPEGRepresentation(resizeImage, 0.8);
//retain it for further use
[toShowFullImage retain];
//set the selected image to button
UIImage *newimage=[image imageScaleAndCropToMaxSize:CGSizeMake(75, 75)];
[button setImage:newimage forState:UIControlStateNormal];
}
此崩溃发生在 iOS 6.0.1 中,出现 Abort trap 6 错误