PDA

View Full Version : How to pass a MKPlacemark to a String?




Nekbeth
May 21, 2011, 03:46 PM
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:

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":

- (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



Nekbeth
May 21, 2011, 04:05 PM
I just did it :eek: , I only need to add this piece of 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?