I'm basically trying to 'get' an image from the users photo library (or camera). The problem is, no image is returned when on iPad (Compatibility mode). Here is the code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSLog(@"info: %@", info);
}
iPhone and iPhone simulator log (Original image exists):
info: {
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x6b6b4e0>";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.JPG?id=39D9190B-064F-4C80-9B93-B4CA4FE01B22&ext=JPG";
}
iPad and iPad simulator (Compatibility mode) log: (there is no Original Image!)
info: {
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.JPG?id=72AF462A-A8CE-4474-9535-B59A3154087D&ext=JPG";
}
Any ideas on why this is happening? I really need the iPad image.
I tried getting the image from the assets library (am i doing this correctly?), but the image is null.
NSURL *imageSource = [info objectForKey:UIImagePickerControllerReferenceURL];
UIImage *image1 = [[UIImage alloc] initWithContentsOfFile:[imageSource absoluteString]];
Thank you for any suggestions.
EDIT: I tried building the application in the iPad 4.3 simulator. Here there are no problems in retrieving the image - the original image exists in the info dictionary. Is there another way to do it in IOS 5?
If you're sure the iPad has the image, it sounds like a bug.
But since you can get the reference url, you can use ALAsset API to get the image.
sorry, it should be
ALAssets
.For your reference,
it is a method of
ALAssetsLibrary
.For more, you can check the document from Apple.