Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8469549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:15:35+00:00 2026-06-10T16:15:35+00:00

basically I am using the example code from http://docs.xamarin.com/ios/recipes/Media/Video_and_Photos/Save_Photo_to_Album_with_Metadata when I would take a

  • 0

basically I am using the example code from http://docs.xamarin.com/ios/recipes/Media/Video_and_Photos/Save_Photo_to_Album_with_Metadata

when I would take a photo and check the files exif data (either through http://exifdata.com/ 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.

btnCamera.Clicked += delegate {
TweetStation.Camera.TakePicture (this, (obj) => {
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) => {

if (error != null) {
Console.WriteLine ("error: "+ error.ToString ());
}
):

Problem is, this doesn’t seem to work, if (error != null) {Console.WriteLine (error.ToString ());} doesn’t print any problems and in the Console.WriteLine (meta.Description); the output is as follows

{
    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;
    };
}

showing the gps data.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:15:37+00:00Added an answer on June 10, 2026 at 4:15 pm

    Also, just FYI, to prevent typos those strings are exposed as the CGImageProperties enum in MonoTouch

    // Add GPS metadata, using data in local variables GpsAltitude, GpsLat, GpsLong, etc
    gpsDict.SetValueForKey(NSObject.FromObject(GpsAltitude), CGImageProperties.GPSAltitude);
    gpsDict.SetValueForKey(NSObject.FromObject(GpsAltitudeRef), CGImageProperties.GPSAltitudeRef);
    
    gpsDict.SetValueForKey(NSObject.FromObject(GpsImgDirection), CGImageProperties.GPSImgDirection);
    gpsDict.SetValueForKey(NSObject.FromObject(GpsImgDirectionRef), CGImageProperties.GPSImgDirectionRef);
    
    gpsDict.SetValueForKey (NSObject.FromObject (GpsLong), CGImageProperties.GPSLongitude);
    gpsDict.SetValueForKey (NSObject.FromObject (GpsLongRef), CGImageProperties.GPSLongitudeRef);
    
    gpsDict.SetValueForKey (NSObject.FromObject (GpsLat), CGImageProperties.GPSLatitude);
    gpsDict.SetValueForKey (NSObject.FromObject (GpsLatRef),CGImageProperties.GPSLatitudeRef);
    
    gpsDict.SetValueForKey (NSObject.FromObject (DateTime.UtcNow.ToString ("HH:MM:ss.ff")), CGImageProperties.GPSTimeStamp);
    
    // Add the GPS data to the metadata
    meta.SetValueForKey (gpsDict, CGImageProperties.GPSDictionary);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the JQuery DropdownChecklist as available from here: http://code.google.com/p/dropdown-check-list/ Basically I'm using some
I am using an example program from this code http://sicktoolbox.sourceforge.net/ > http://sourceforge.net/projects/sicktoolbox/files/ . It's
Basically I am using some open source code called OrderedDictionary that is derived from
Details: I'm basically trying to implement the functionality of the example here ( http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultvb.aspx
I'm trying to extract the postal codes from yell.com using php and preg_replace. I
Im using phonegap + jquery + jquery iphone touch: http://www.midemos.com/demos/iphone/touch/?/iphone/touch/ Im trying to get
I am trying to make the buffer exploitation example (example3.c from http://insecure.org/stf/smashstack.html ) work
I went through the code at the following two links: http://pastebin.com/iUd22CRY http://www.jensbits.com/2009/10/04/jquery-ajax-and-jquery-post-form-submit-examples-with-php Everything seems
If you check out http://thecomputerwarehouse.com/test.php you can see a working example of what I
Given an app called ExampleApp, I want to find ~/Library/Logs/ExampleApp basically without using hard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.