简体   繁体   中英

iPhone default map app open with current userlocation

In my app, on button click I am opening default iphone map application as follows:-

NSString *mystr=[[NSString alloc] initWithFormat:@"http://maps.google.com/maps?saddr=%@&daddr=%@",userlocation,desti_latlong];
NSURL *myurl=[[NSURL alloc] initWithString:mystr];
[[UIApplication sharedApplication] openURL:myurl];

In that desti_latlong is destination latitude longitude string and userlocation is user's latitude longitude string found by corelocation(location manager).

But I want to add source location as "Current Location" string on this API. If we use Iphone defualt map app directly we can give current location it will popup in blue string Can I make this from my app so that If user moves location updated on map.

thanx for any Help!

OHh yes i was writing directly Current Location but I need to write Current+Location.solved that

NSString *mystr=[[NSString alloc] initWithFormat:@"http://maps.google.com/maps?saddr=Current+Location&daddr=Destination"];
NSURL *myurl=[[NSURL alloc] initWithString:mystr];
[[UIApplication sharedApplication] openURL:myurl];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM