Я пишу небольшую программу для установки информации GPS о фотографии iphone jpg. Это хорошо работает в iOS 12.4.2, но когда я обновляю iOS 13.1.2, я не вижу GPSTimeStamp, GPSDateStamp. Как я могу интерпретировать это? Спасибо!
+(NSMutableDictionary *)setLocationMetaData:(CLLocation *)location {
if (location) {
CLLocationDegrees exifLatitude = location.coordinate.latitude;
CLLocationDegrenter code hereees exifLongitude = location.coordinate.longitude;
CGFloat altitude = location.altitude;
NSString *latRef;
NSString *lngRef;
int altitudeRef = 0;
if (exifLatitude < 0.0) {
exifLatitude = exifLatitude * -1.0f;
latRef = @"S";
} else {
latRef = @"N";
}
if (exifLongitude < 0.0) {
exifLongitude = exifLongitude * -1.0f;
lngRef = @"W";
} else {
lngRef = @"E";
}
if (altitude < 0.0) {
altitude = altitude * -1.0f;
altitudeRef = 1;
}
NSMutableDictionary *locDict = [[[NSMutableDictionary alloc] init] autorelease];
[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];
[locDict setObject:[NSNumber numberWithFloat:location.horizontalAccuracy] forKey:(NSString*)kCGImagePropertyGPSDOP];
[locDict setObject:[NSNumber numberWithFloat:altitude] forKey:(NSString*)kCGImagePropertyGPSAltitude];
[locDict setObject:[NSNumber numberWithInt:altitudeRef] forKey:(NSString*)kCGImagePropertyGPSAltitudeRef];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH:mm:ss.SSSSSS"];
[formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
[locDict setObject:[formatter stringFromDate:location.timestamp] forKey:(NSString *)kCGImagePropertyGPSTimeStamp];
[formatter setDateFormat:@"yyyy:MM:dd"];
[locDict setObject:[formatter stringFromDate:location.timestamp] forKey:(NSString *)kCGImagePropertyGPSDateStamp];
return locDict;
}