我正在我的 iOS 应用程序中实现相机应用程序功能,问题是当我在阳光下单击图片时,它会使我的应用程序崩溃,但它在 deamLight 中运行良好。
我点击图片的代码
loadingOutlet.hidden=NO;
imagePicker = [[UIImagePickerController alloc]init];
imagePicker.delegate=self;
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController: imagePicker animated:YES completion:nil ];
[self.view bringSubviewToFront:imageView];
CameraPic=YES;
这是用于在上传时压缩图像UIImageView
-(void)loadImgInNSData
{
double size;
int compressionRatio=1;
while ([imgDataCompressImg length]>50000)
{
size = [imgDataCompressImg length];
compressionRatio=compressionRatio*0.5;
imgDataCompressImg=UIImageJPEGRepresentation([[UIImage alloc] initWithData:imgDataCompressImg],compressionRatio);
NSLog(@"%i",[imgDataCompressImg length]);
if (size-[imgDataCompressImg length]<500000)
{
break;
}
}
}
请尽快帮助我