未声明ALAsset valueForProperty:ALAssetPropertyLocation吗? [英] ALAsset valueForProperty:ALAssetPropertyLocation undeclared?
问题描述
这似乎太简单了,或者可能只是让我感到困惑……或者我太累了,无法理性地思考。
This might seem too easy or maybe it's just confusing for me... Or maybe I'm too tired to think rationally.
我正试图用户已使用imagePickerController从相册中选择的UIImage的位置。
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];
}
现在,我尝试在其中调用 valueForProperty 因为ALAsset是我遇到的麻烦。这是我遇到的错误:
Now, where I try to call the valueForProperty for ALAsset is where I have trouble. This is the error I'm getting:
使用未声明的标识符 ALAssetPropertyLocation。
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>
感谢Markus指出了这一点!
Thanks to markus who pointed it out!
这篇关于未声明ALAsset valueForProperty:ALAssetPropertyLocation吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!