ちょろっと書いて動かしてみたら動いたのでメモ。
これで取得できる内容をEvernote のノート作成時に盛りたい。
// CoreLocation.framework の追加と、ヘッダーインポートをしておくこと - (NSDictionary *)GPSDictionaryForLocation:(CLLocation *)location { NSMutableDictionary *gps = [NSMutableDictionary new]; NSDateFormatter *formatter = [NSDateFormatter new]; [formatter setDateFormat:@"HH:mm:ss.SSSSSS"]; [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; [gps setObject:[formatter stringFromDate:location.timestamp] forKey:(NSString *)kCGImagePropertyGPSTimeStamp]; [formatter setDateFormat:@"yyyy:MM:dd"]; [gps setObject:[formatter stringFromDate:location.timestamp] forKey:(NSString *)kCGImagePropertyGPSDateStamp]; // 緯度 CGFloat latitude = location.coordinate.latitude; NSString *gpsLatitudeRef; if (latitude < 0) { latitude = -latitude; gpsLatitudeRef = @"S"; } else { gpsLatitudeRef = @"N"; } gps[(NSString *)kCGImagePropertyGPSLatitudeRef] = gpsLatitudeRef; gps[(NSString *)kCGImagePropertyGPSLatitude] = @(latitude); // 経度 CGFloat longitude = location.coordinate.longitude; NSString *gpsLongitudeRef; if (longitude < 0) { longitude = -longitude; gpsLongitudeRef = @"W"; } else { gpsLongitudeRef = @"E"; } gps[(NSString *)kCGImagePropertyGPSLongitudeRef] = gpsLongitudeRef; gps[(NSString *)kCGImagePropertyGPSLongitude] = @(longitude); // 標高 CGFloat altitude = location.altitude; if (!isnan(altitude)){ NSString *gpsAltitudeRef; if (altitude < 0) { altitude = -altitude; gpsAltitudeRef = @"1"; } else { gpsAltitudeRef = @"0"; } gps[(NSString *)kCGImagePropertyGPSAltitudeRef] = gpsAltitudeRef; gps[(NSString *)kCGImagePropertyGPSAltitude] = @(altitude); } return gps; }