iOS 4:FigCreateCGImageFromJPEG 返回 -1
我试图在我的应用程序中运行一个基本的图像选择器/照片拍摄器,但遇到了以下错误:
*** ERROR: FigCreateCGImageFromJPEG returned -1. Input (null) was 551120 bytes
我显示了图像选择器,相机视图工作正常。
当我使用相机拍摄图像并选择“使用”按钮时,控制台中会出现错误并且应用程序崩溃。
该应用程序仅适用于从相册中选择图像。我在这里查看了类似的线程,似乎没有解决方案已被提议。
只是想知道是否有人遇到过任何有帮助的事情。
-(IBAction)getPhoto:(id)sender{
if((UIButton *) sender == sharePhoto) {
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
[self presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@""];
}
I'm trying to get a basic image picker/photo taker running in my app and have run into the following error:
*** ERROR: FigCreateCGImageFromJPEG returned -1. Input (null) was 551120 bytes
I have the image picker showing, the camera view works fine.
When I take an image with the camera and select the 'use' button the error appears in the console and the app crashes.
The App works fine just for selecting an image from the album. I have looked at similar threads here and no solution seems to have been proposed.
Just wondering if anyone has come across anything helpful.
-(IBAction)getPhoto:(id)sender{
if((UIButton *) sender == sharePhoto) {
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
[self presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@""];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已设法阻止应用程序崩溃,但错误仍然存在。
我没有将
NSDictionary *info
中的UIImage
直接分配给我的UIImageView
,而是将其保留在UIImage
变量中,然后关闭ModalViewcontroller
。然后,在根
UIViewController
的 viewWillAppear 方法中,我将图像分配给我的UIImageView
.image。我不知道我做事的顺序是否是根本原因。但是该错误仍然出现在控制台中。
I have managed to stop my application crashing but the error persist.
Instead of assigning the
UIImage
from theNSDictionary *info
straight to myUIImageView
I retain it in aUIImage
variable then dismiss theModalViewcontroller
.In the
viewWillAppear
method of the rootUIViewController
I then assign the image to myUIImageView
.image.I don't know if the order I was doing things was the root cause. The error still appears in the console however.