Permalink
Browse files

Setting location after heading does NOT overwrite heading

  • Loading branch information...
1 parent 6b3148a commit 51681773fa53f04e69ef2d921b751551ff785559 @markpmiles markpmiles committed Jul 1, 2011
Showing with 9 additions and 7 deletions.
  1. +9 −7 GusUtils/NSMutableDictionary+ImageMetadata.m
View
16 GusUtils/NSMutableDictionary+ImageMetadata.m
@@ -108,13 +108,15 @@ - (void)setLocation:(CLLocation *)location {
lngRef = @"E";
}
- NSDictionary* locDict = [[NSDictionary alloc] initWithObjectsAndKeys:
- location.timestamp, (NSString*)kCGImagePropertyGPSTimeStamp,
- latRef, (NSString*)kCGImagePropertyGPSLatitudeRef,
- [NSNumber numberWithFloat:exifLatitude], (NSString*)kCGImagePropertyGPSLatitude,
- lngRef, (NSString*)kCGImagePropertyGPSLongitudeRef,
- [NSNumber numberWithFloat:exifLongitude], (NSString*)kCGImagePropertyGPSLongitude,
- nil];
+ NSMutableDictionary *locDict = [[NSMutableDictionary alloc] init];
+ if ([self objectForKey:(NSString*)kCGImagePropertyGPSDictionary]) {
+ [locDict addEntriesFromDictionary:[self objectForKey:(NSString*)kCGImagePropertyGPSDictionary]];
+ }
+ [locDict setObject:location.timestamp forKey:(NSString*)kCGImagePropertyGPSTimeStamp];
+ [locDict setObject:latRef forKey:(NSString*)kCGImagePropertyGPSLatitudeRef];
+ [locDict setObject:[NSNumber numberWithFloat:exifLatitude] forKey:(NSString*)kCGImagePropertyGPSLatitude];
+ [locDict setObject:lngRef forKey:(NSString*)kCGImagePropertyGPSLongitudeRef];
+ [locDict setObject:[NSNumber numberWithFloat:exifLongitude] forKey:(NSString*)kCGImagePropertyGPSLongitude];
[self setObject:locDict forKey:(NSString*)kCGImagePropertyGPSDictionary];
[locDict release];

0 comments on commit 5168177

Please sign in to comment.