Note that there are some explanatory texts on larger screens.

plurals
  1. POGps exif data not saved when using WriteImageToSavedPhotosAlbum
    text
    copied!<p>basically I am using the example code from <a href="http://docs.xamarin.com/ios/recipes/Media/Video_and_Photos/Save_Photo_to_Album_with_Metadata" rel="nofollow">http://docs.xamarin.com/ios/recipes/Media/Video_and_Photos/Save_Photo_to_Album_with_Metadata</a></p> <p>when I would take a photo and check the files exif data (either through <a href="http://exifdata.com/" rel="nofollow">http://exifdata.com/</a> or Exif-Wizard on the Device), I noticed the exif data did not contain GPS information, so I manually collect the location information, format it, and add it to a dictionary and include that in the meta dictionaries as seen below.</p> <pre><code>btnCamera.Clicked += delegate { TweetStation.Camera.TakePicture (this, (obj) =&gt; { var photo = obj.ValueForKey (new NSString ("UIImagePickerControllerOriginalImage")) as UIImage; var meta = obj.ValueForKey (new NSString ("UIImagePickerControllerMediaMetadata")) as NSMutableDictionary; var gpsDict = new NSMutableDictionary (); ... gpsDict.SetValueForKey (NSObject.FromObject (GpsLong), new NSString ("GPSLongitude")); gpsDict.SetValueForKey (NSObject.FromObject (GpsLongRef), new NSString ("GPSLongitudeRef")); gpsDict.SetValueForKey (NSObject.FromObject (GpsLat), new NSString ("GPSLatitude")); gpsDict.SetValueForKey (NSObject.FromObject (GpsLatRef), new NSString ("GPSLatitudeRef")); gpsDict.SetValueForKey (NSObject.FromObject (DateTime.UtcNow.ToString ("HH:MM:ss.ff")), new NSString ("GPSTimeStamp")); meta.SetValueForKey (gpsDict, new NSString ("{GPS}")); Console.WriteLine (meta.Description); ALAssetsLibrary library = new ALAssetsLibrary (); library.WriteImageToSavedPhotosAlbum (photo.CGImage, meta, (assetUrl, error) =&gt; { if (error != null) { Console.WriteLine ("error: "+ error.ToString ()); } ): </code></pre> <p>Problem is, this doesn't seem to work, <code>if (error != null) {Console.WriteLine (error.ToString ());}</code> doesn't print any problems and in the <code>Console.WriteLine (meta.Description);</code> the output is as follows </p> <pre><code>{ DPIHeight = 72; DPIWidth = 72; Orientation = 6; "{Exif}" = { ApertureValue = "2.970853654340484"; BrightnessValue = "1.87496238139573"; ColorSpace = 1; DateTimeDigitized = "2012:08:02 17:12:42"; DateTimeOriginal = "2012:08:02 17:12:42"; ExposureMode = 0; ExposureProgram = 2; ExposureTime = "0.06666666666666667"; FNumber = "2.8"; Flash = 24; FocalLength = "3.85"; ISOSpeedRatings = ( 160 ); MeteringMode = 5; PixelXDimension = 2592; PixelYDimension = 1936; SceneType = 1; SensingMethod = 2; Sharpness = 2; ShutterSpeedValue = "3.911199862602335"; SubjectArea = ( 1295, 967, 699, 696 ); WhiteBalance = 0; }; "{GPS}" = { GPSLatitude = "30.35974270979283"; GPSLatitudeRef = N; GPSLongitude = "91.13930279830274"; GPSLongitudeRef = W; GPSTimeStamp = "22:08:44.66"; }; "{TIFF}" = { DateTime = "2012:08:02 17:12:42"; Make = Apple; Model = "iPhone 4"; Software = "5.0.1"; XResolution = 72; YResolution = 72; }; } </code></pre> <p>showing the gps data.</p> <p>So, I am curious as to what I am doing wrong, I am very new to monotouch (mac as well) so you'll forgive the general WTF'ery please.</p>
 

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