且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用我的ios应用程序中的指示打开Apple地图应用程序

更新时间:2023-01-01 17:00:25

如果您的意思是根据两点将用户带到地图应用程序,那么您可以这样做:

If you mean taking the user to the maps application based on two points, then you can do it like this:

创建一个如下所示的NSURL:

Create an NSURL that looks like this:

NSURL *URL = [NSURL URLWithString:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f"];

您可以适当地插入起始地址和目的地(在lat。和long。)。
告诉您的应用程序打开URL

You plug in your starting address and destination (in lat. and long.) appropriately. Tell your application to open the URL

[[UIApplication sharedApplication] openURL:URL];

它会自动带你到地图应用程序!

It should take you to the maps application automatically!