我基本上試圖從用戶照片庫(或相機)「獲取」圖像。 問題是,沒有圖像返回當在iPad上(兼容模式)。 下面是代碼:didFinishPickingMediaWithInfo返回的圖像:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSLog(@"info: %@", info);
}
iPhone和iPhone模擬器日誌(原始圖像存在):
info: {
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x6b6b4e0>";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.JPG?id=39D9190B-064F-4C80-9B93-B4CA4FE01B22&ext=JPG";
}
的iPad和iPad模擬器(兼容模式)日誌:(!沒有原始圖像)
info: {
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.JPG?id=72AF462A-A8CE-4474-9535-B59A3154087D&ext=JPG";
}
關於爲什麼會發生這種情況的任何想法?我真的需要iPad圖像。
我試圖從資產庫中獲取圖像(我是否正確地做這件事?),但圖像爲空。
NSURL *imageSource = [info objectForKey:UIImagePickerControllerReferenceURL];
UIImage *image1 = [[UIImage alloc] initWithContentsOfFile:[imageSource absoluteString]];
謝謝你的任何建議。
編輯:我試着在iPad 4.3模擬器中構建應用程序。這裏檢索圖像沒有問題 - 原始圖像存在於信息詞典中。 IOS 5還有另一種方法嗎?
以及只是從資產中抓取圖片... – Daniel
我該怎麼做? – SEG
我也一樣。我嘗試了5.0,5.1和6.0版本的所有iPad模擬器。所有返回零。不過,它在我的iPad(設備)和OS 5.1.1中工作正常。我認爲這只是一個模擬器上的錯誤。 – GeneCode