在iOS 10 Objective-C和
Xcode 8中从图像选择器中选择一个图像.我收到一个错误 –
Creating an image format with an unkNown type is an error
.
对于以前的版本是可以的.
这是我的代码:
UIImagePickerController* imgPicker=[[UIImagePickerController alloc] init]; imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; imgPicker.delegate = self; [self presentViewController:imgPicker animated:YES completion:nil];
并且代理回收图像的方法是..
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediawithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:NULL];
UIImage *myImage = [info objectForKey:UIImagePickerControllerOriginalImage];
}
我也试过其他委托函数..
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediawithInfo:(NSDictionary<Nsstring *,id> *)info{
}
但错误不行.
我不确定是Xcode 8的错误吗?如果有人面对这个问题并解决,请帮忙解决.
解决方法
这是一个bug.这只是一个假警告.应用程序的工作没有坏事,所以忽略警告.