Objective c iPhone应用程序在iPad视网膜上运行,带有图像选择器,但图像选择器对象为零
这是iPhone应用程序代码,但当我遇到ipad视网膜模拟器或ipad时,它会使应用程序崩溃。我检查了很多次&我意识到选择器对象为零。但它在iPhone模拟器上运行良好。有人知道这个吗?这个应用程序只生产iPhone,但在iPad视网膜和iPad上运行Objective c iPhone应用程序在iPad视网膜上运行,带有图像选择器,但图像选择器对象为零,objective-c,iphone,ios7,uiimageview,ipad-2,Objective C,Iphone,Ios7,Uiimageview,Ipad 2,这是iPhone应用程序代码,但当我遇到ipad视网膜模拟器或ipad时,它会使应用程序崩溃。我检查了很多次&我意识到选择器对象为零。但它在iPhone模拟器上运行良好。有人知道这个吗?这个应用程序只生产iPhone,但在iPad视网膜和iPad上运行 UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; // image picker alloc imagePicker.delegate
UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; // image picker alloc
imagePicker.delegate = self; // delegate call by self
imagePicker.allowsEditing = YES;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; //Pick image in Library
[self presentModalViewController:imagePicker animated:YES]; // OPen Library
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
imgImage = info[UIImagePickerControllerOriginalImage]; //Get Orginial Images
imgData = [[NSData alloc] initWithData:UIImageJPEGRepresentation((imgImage), 0.9)]; // Jpg image format
[picker dismissModalViewControllerAnimated:YES];
} // pick image from this method
尝试此操作…当从库中选择图像或从相机拍摄图像时,将调用此方法
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];
NSData *imgData = UIImagePNGRepresentation(image);
[picker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self dismissViewControllerAnimated:YES completion:NULL];
}
当它崩溃时,调试器中显示的错误消息具体是什么?***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“***setObjectForKey:object不能为nil key:Image”如果您知道这件事,请帮助我。它崩溃的行的内容是什么?如果可能,您可以提供它和任何周围的行吗?打印返回的NSDictionary可能有助于调试,如下所示:NSLog@info=%@,信息;UIImage*myImage=[info objectForKey:UIImagePickerControllerOriginalImage];我没有我的形象没有另一行崩溃。错误:-***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“***setObjectForKey:对象不能为零键:图像”