Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After much searching I found and adapted this </p> <p>This turns cclocation data into a suitable NSDictionary </p> <pre><code> #import &lt;ImageIO/ImageIO.h&gt; +(NSMutableDictionary *)updateExif:(CLLocation *)currentLocation{ NSMutableDictionary* locDict = [[NSMutableDictionary alloc] init]; CLLocationDegrees exifLatitude = currentLocation.coordinate.latitude; CLLocationDegrees exifLongitude = currentLocation.coordinate.longitude; [locDict setObject:currentLocation.timestamp forKey:(NSString*)kCGImagePropertyGPSTimeStamp]; if (exifLatitude &lt;0.0){ exifLatitude = exifLatitude*(-1); [locDict setObject:@"S" forKey:(NSString*)kCGImagePropertyGPSLatitudeRef]; }else{ [locDict setObject:@"N" forKey:(NSString*)kCGImagePropertyGPSLatitudeRef]; } [locDict setObject:[NSNumber numberWithFloat:exifLatitude] forKey:(NSString*)kCGImagePropertyGPSLatitude]; if (exifLongitude &lt;0.0){ exifLongitude=exifLongitude*(-1); [locDict setObject:@"W" forKey:(NSString*)kCGImagePropertyGPSLongitudeRef]; }else{ [locDict setObject:@"E" forKey:(NSString*)kCGImagePropertyGPSLongitudeRef]; } [locDict setObject:[NSNumber numberWithFloat:exifLongitude] forKey:(NSString*) kCGImagePropertyGPSLongitude]; return [locDict autorelease]; } </code></pre> <p>Then I add it to the existing metadata that you get through the camera (which doesn't by default have the gps data) </p> <p>I get the original metadata like this</p> <pre><code>-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ [imageMetaData setDictionary:[[info objectForKey:UIImagePickerControllerMediaMetadata] copy]]; } </code></pre> <p>then I add the gps dictionary the previous method produces.</p> <pre><code>[imageMetaData setObject:currentLocation forKey:(NSString*)kCGImagePropertyGPSDictionary]; [library writeImageToSavedPhotosAlbum:[viewImage CGImage] metadata:imageMetaData completionBlock:photoCompblock]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload