ALAsset valueForProperty:ALAssetPropertyLocation undeclared?

醉酒当歌 提交于 2019-12-23 01:07:13

问题


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...


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!