【发布时间】:2012-04-26 23:43:09
【问题描述】:
这可能看起来太容易了,或者只是让我感到困惑......或者我太累了,无法理性思考。
我正在尝试使用 imagePickerController 从相册中获取用户已选择的 UIImage 的位置。
- (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];
}
现在,我尝试为 ALAsset 调用 valueForProperty 是我遇到问题的地方。这是我得到的错误:
使用未声明的标识符“ALAssetPropertyLocation”。
请帮忙!这真是令人沮丧...我需要照片的位置...
【问题讨论】:
-
您使用的是 iOS 4.0+ 吗?你检查你的进口:#import
-
不!我刚刚做到了,它解决了问题!
-
我唯一的导入是#import "AssetsLibrary/ALAssetsLibrary.h" 我认为它是正确的......非常感谢!
标签: iphone objective-c ios uiimagepickercontroller alasset