This might seem too easy or maybe it's just confusing for me... Or maybe I'm too tired to think rationally.
I am trying to get the location of an UIImage that has been selected by the user from the photo album using imagePickerController.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *pic = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSData *data = UIImageJPEGRepresentation(pic, 0.01f);
UIImage *image1 = [UIImage imageWithData:data];
bookmarkImage.image = image1;
NSLog(@"new image size = %i", [data length]);
NSURL *url = [info objectForKey:@"UIImagePickerControllerReferenceURL"];
4NSLog(@"%@",url);
ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset *myAsset){
[myAsset valueForProperty:ALAssetPropertyLocation];
};
[self dismissModalViewControllerAnimated:YES];
}
Now, where I try to call the valueForProperty for ALAsset is where I have trouble. This is the error I'm getting:
Use of undeclared identifier 'ALAssetPropertyLocation'.
Please help! This is getting really frustrating... I need the location of the photo...
It's pretty silly but I've been missing an import:
#import <AssetsLibrary/ALAsset.h>
Thanks to markus who pointed it out!
来源:https://stackoverflow.com/questions/10342931/alasset-valueforpropertyalassetpropertylocation-undeclared