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 8477011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:20:16+00:00 2026-06-10T18:20:16+00:00

Sir, Here i need to add geolocation from metadata to uiimage but after adding

  • 0

Sir,
Here i need to add geolocation from metadata to uiimage but after adding i just loading in to photoalbum only but here i need that image,here i have added the source code

- (void) saveImage:(UIImage *)imageToSave withInfo:(NSDictionary *)info
{
    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];


        // Get the image metadata (EXIF & TIFF)    
    NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
    [defaults objectForKey:latkey];
    float longitude=[defaults floatForKey:longkey];
    float latitude=[defaults floatForKey:latkey];    
    CLLocation * loc=[[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
    NSMutableDictionary *metaDict = nil;
    if ([info objectForKey:UIImagePickerControllerOriginalImage] != nil) {
        metaDict = [NSMutableDictionary dictionaryWithDictionary:[info objectForKey:UIImagePickerControllerMediaMetadata]];
        NSDictionary *gpsDict = [self currentLocation:loc];
        if ([gpsDict count] > 0) {
            [metaDict setObject:gpsDict forKey:(NSString*)kCGImagePropertyGPSDictionary];
        }
    }
    [library writeImageToSavedPhotosAlbum:[imageToSave CGImage] metadata:metaDict completionBlock:^(NSURL *newURL, NSError *error) {
        if (error) {

        } else {
        }
    }];

    NSLog(@"metaDict  :%@",metaDict);


    NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL];
    [library assetForURL:referenceURL resultBlock:^(ALAsset *asset) {
        ALAssetRepresentation *rep = [asset defaultRepresentation];
        NSDictionary *metadata = rep.metadata;
        NSLog(@"%@", metadata);

        CGImageRef iref = [rep fullScreenImage] ;

        if (iref) {
            capturedImage.image = [UIImage imageWithCGImage:iref];
        }
    } failureBlock:^(NSError *error) {
            // error handling
    }];
}

Creates an EXIF field for the current geo location.

- (NSMutableDictionary*)currentLocation:(CLLocation *)location{
    NSMutableDictionary *locDict = [[NSMutableDictionary alloc] init];

    if (location != nil) {
        CLLocationDegrees exifLatitude = location.coordinate.latitude;
        CLLocationDegrees exifLongitude = location.coordinate.longitude;

        [locDict setObject:location.timestamp forKey:(NSString*)kCGImagePropertyGPSTimeStamp];

        if (exifLatitude < 0.0) {
            exifLatitude = exifLatitude*(-1);
            [locDict setObject:@"S" forKey:(NSString*)kCGImagePropertyGPSLatitudeRef];
        } else {
            [locDict setObject:@"N" forKey:(NSString*)kCGImagePropertyGPSLatitudeRef];
        }
        [locDict setObject:[NSNumber numberWithFloat:exifLatitude] forKey:(NSString*)kCGImagePropertyGPSLatitude];

        if (exifLongitude < 0.0) {
            exifLongitude=exifLongitude*(-1);
            [locDict setObject:@"W" forKey:(NSString*)kCGImagePropertyGPSLongitudeRef];
        } else {
            [locDict setObject:@"E" forKey:(NSString*)kCGImagePropertyGPSLongitudeRef];
        }
        [locDict setObject:[NSNumber numberWithFloat:exifLongitude] forKey:(NSString*) kCGImagePropertyGPSLongitude];
    }

    return [locDict autorelease];
}

please help me

  • 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-10T18:20:18+00:00Added an answer on June 10, 2026 at 6:20 pm

    EDIT : U can get image add in photo Album like by following this link.

    Now if u have asset then using asset’s created date u can know last photo added like this as save date before adding to photo album :

    NSDate *imgCreateddate = [asset valueForProperty:ALAssetPropertyDate];
    if(imgCreateddate isGreaterThan savedDate)
    {
      last Photo;
    }
    

    Refer Adding metadata to iOS images the easy way link.

    Refer GusUtils for sample code.

    Refer saving-geotag-info-with-photo link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sir, these days i am improving my recursion skills but i am stuck in
Sir, I am doing the task on fetching the contents from the xml file.I
Hello sir i send the arraylist through url pass from android to php all
Sir/Madam, I want to know where WSDL exists. Do user need to do interact
Respected Sir, Here i am using the uiimagepickercontroller to open the camera and taking
Here is an example from Bruce Eckel Thinking in Java, 4th edition import java.io.BufferedReader;
just a simple question here. How can I get the return value on this
Respected Sir! As i have not learnt java yet but most people say that
hello sir in login page i am validating username and password from server database.
Sir, I am having some problem regarding database in SQL Server. My project is

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.