How to pass a MKPlacemark to a String?

Discussion in 'iPhone/iPad Programming' started by Nekbeth, May 21, 2011.

  1. macrumors member

    Nekbeth

    Joined:
    Feb 20, 2011
    Location:
    Vatican City
    #1
    Hi, I'm trying to pass the result of a MKPlacemark instance to a String named "address". The placemark instance has the current location and it changes every time I press a button.

    I know I have to pass it with a Format:

    Code:
    	NSString *someText = [NSString stringWithFormat:@"%@", address];
    
    I'm having trouble passing the value from MKPlacemark to the address String. What I have so far is the method of reverse geocoder did finish, it gets its info from a "placemarkviewcontroller":

    Code:
    - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
    {
        PlacemarkViewController *placemarkViewController =
        [[PlacemarkViewController alloc] initWithNibName:@"PlacemarkViewController" bundle:nil];
        placemarkViewController.placemark = placemark;
        [self presentModalViewController:placemarkViewController animated:YES];
        
        
    }
    the placemark result is correct, I can even show it on a table view. I just want to make it a String. (So I can use it with ShareKit)

    Thanks
     
  2. thread starter macrumors member

    Nekbeth

    Joined:
    Feb 20, 2011
    Location:
    Vatican City
    #2
    I just did it :eek: , I only need to add this piece of code:


    Code:
        x = [[NSString alloc] initWithFormat:@"%@",placemark];
    
    Then use x variable inside the IBAction message share.


    Does anyone know how to get a google link of the current address?
     

Share This Page