我目前正在开展一个项目,我需要阅读一些(纬度,经度和日期)EXIF数据.位置数据似乎是正确的,但我得到的日期似乎是"最后修改日期"日期.
{
CLLocation *loc = [asset valueForProperty:ALAssetPropertyLocation];
NSDate *date = [asset valueForProperty:ALAssetPropertyDate];
//Returns Last modified date(Picture was taken ... let's say september
//last year and it would return the date and time I 'modified' the image).
NSString *latitude = [NSString stringWithFormat:@"%g",loc.coordinate.latitude];//Returns correct Latitude
NSString *longitude = [NSString stringWithFormat:@"%g",loc.coordinate.longitude];//Returns correct Longitude
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:我做的事情是非常错误的,还是这种预期的行为.我也尝试使用loc.timestamp
而不是[asset valueForProperty:ALAssetPropertyDate]
但这些返回相同的日期.任何帮助是极大的赞赏 !
嘿伙计们,我目前正试图通过用户从用户选择的图像中获取EXIF数据UIIMagePickerController
.我似乎无法理解如何获得我可以使用的路径CGImageSourceCreateWithURL((CFURLRef)someURL,nil)
.
当我尝试使用UIImagePickerControllerReferenceURL
控制台时吐出一个相当不错的错误:<ERROR> CGImageSourceCreateWithURLCFURLCreateDataAndPropertiesFromResource failed with error code -11.
.我很难过,我开始认为我来自一个完全错误的角度,因为这种CGImageSourceRef
类型通常用于创建图像,而我已经有了UIImage
.任何能够解释这个问题的人,请随时这样做.
- (void)imagePickerController:(UIImagePickerController*)pickerdidFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
[self dismissModalViewControllerAnimated:YES];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]){
image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSLog(@"%@",[info objectForKey:UIImagePickerControllerReferenceURL]);
//Outputs: assets-library://asset/asset.JPG?id=1000000006&ext=JPG
CGImageSourceCreateWithURL((CFURLRef)[info objectForKey:UIImagePickerControllerReferenceURL], nil);
//The plan is to somehow get a CGImageSourceRef object from the
//UIImage provided by the [info UIImagePickerControllerOriginalImage], i just don't know how to get this object,
// for it requires the URL to the …
Run Code Online (Sandbox Code Playgroud)