Ketan Odedra
Ketan Odedra

Reputation: 1283

How to share Location to Whatsapp,Facebook etc

I add Button in this screen and created that UIButton action, now i want to share location to Whatsapp,Facebook etc.,same as Whatsapp location sending feature.

i don't know how to do it, plz help me.

enter image description here

Upvotes: 2

Views: 921

Answers (1)

Thiyagu Rajendran
Thiyagu Rajendran

Reputation: 655

Since, there is no documentation available to share geo location to whatsapp. You can share a location with WhatsApp through the custom URL scheme. (**Note Geo location send as strings).

NSString *geoMessage = @"geo:23.1097,-82.4094"; //parse your geolocation here
NSString *whatsappURLString = [NSString stringWithFormat:@"whatsapp://send?text=%@", geoMessage];
NSURL *whatsappURL = [NSURL URLWithString:whatsappURLString];

if ([[UIApplication sharedApplication] canOpenURL:whatsappURL]) {
[[UIApplication sharedApplication] openURL:whatsappURL];
} else {
// WhatsApp not installed
}

For more info, see WhatsApp's FAQ page about the custom URL scheme: http://www.whatsapp.com/faq/en/iphone/23559013

Upvotes: 3

Related Questions