從圖像選擇器中選擇一個圖像iOS 10
Objective-C
和Xcode 8
。我得到一個錯誤 -創建一個未知類型的圖像格式是一個錯誤Objective-C Xcode 8
創建一個未知類型的圖像格式是一種錯誤
。
以前的版本可以。
這裏是我的代碼:
UIImagePickerController* imgPicker=[[UIImagePickerController alloc] init];
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imgPicker.delegate = self;
[self presentViewController:imgPicker animated:YES completion:nil];
和委託方法來recive的形象..
- (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嗎?
如果有人遇到問題並解決,請幫助解決。
http://stackoverflow.com/questions/39009889/xcode-8-creating-an-image-format-with-an-unknown-type-is-an-error? – Larme
其快捷版本。我也用新的委託方法工作,但不工作。 –
你是如何解決這個問題的? –