0 Replies
      Latest reply on Oct 16, 2019 7:32 AM by BDms
      BDms Level 1 Level 1 (0 points)

        Here is a piece of code I write in:

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

            PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];

            if (status == PHAuthorizationStatusAuthorized) {

                  if (@available(iOS 11.0, *)) {

                      NSDictionary *mediaMetadata= info[UIImagePickerControllerMediaMetadata];


        mediaMetadata does not contain any GPS coordinates information (in two cases:

        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        and: picker.sourceType = UIImagePickerControllerSourceTypeCamera; )


        If I use a photo from Photos, for example:

            NSString *imgPath = [[NSBundle mainBundle] pathForResource:@"IMG_1998" ofType:@"jpeg"];

            NSURL *myURL = [NSURL fileURLWithPath:imgPath];

            CGImageSourceRef imgSourceRef = CGImageSourceCreateWithURL((CFURLRef)myURL, NULL);

            NSDictionary *mediaMetadata = (NSDictionary *) CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(imgSourceRef,0,NULL));


        Then, mediaMetadata contains a lot of information, however, GPS data still does not appear.

        Please show me how to get the GPS data?.

        Sincerely thank.