ios 获取照片gps信息问题
阿神
阿神 2017-04-17 14:00:09
0
1
854

我的代码如下:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{



    NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];

    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
    [library assetForURL:assetURL
             resultBlock:^(ALAsset *asset) {
                 NSDictionary *imageMetadata = [[NSMutableDictionary alloc] initWithDictionary:asset.defaultRepresentation.metadata];
                 self.photoInfoDic = imageMetadata;
                 NSLog(@"哈哈哈%@", self.photoInfoDic);
                 NSDictionary *gpsDic = [imageMetadata objectForKey:@"{GPS}"];
                 /* gpsDic 里面即是照片的GPS信息,具体可以输出看看*/
                 self.photo = [info objectForKey:UIImagePickerControllerEditedImage];
                 [self goFilterViewController];

             }
            failureBlock:^(NSError *error) {

            }];



}

实现的效果就是,有些照片可以获取到gps,有些不可以。比如某张照片,iPhone里面是可以显示地理位置的,就是iPhone自带的相册,我用QQ发布到空间,QQ是也是可以获取到照片的地理位置的。唯独我这个代码,有些照片可以,有些不可以。很奇怪,求解?


最后用第三方的图片选择器就能获取到,自带的这个获取不到,暂时找不到原因

阿神
阿神

闭关修行中......

reply all(1)
洪涛

Could you please tell me which third-party image selector you are using? What I am doing now is also the function of obtaining the geographical information of photos. Please give me some advice

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!