使用纬度和经度打开带有图钉的iOS地图

Mat*_*der 9 mapkit ios

我使用此代码打开地图应用程序

NSString* versionNum = [[UIDevice currentDevice] systemVersion];
    NSString *nativeMapScheme = @"maps.apple.com";
    if ([versionNum compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending){
        nativeMapScheme = @"maps.google.com";
    }
    NSString* url = [NSString stringWithFormat:@"http://%@/maps?ll=%f,%f", nativeMapScheme, 40.739490, -73.991154];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
Run Code Online (Sandbox Code Playgroud)

似乎它运作良好,但我使用的这个位置没有引脚.如何添加引脚,我想在请求中还有其他参数?

Kal*_*era 12

如果您希望将该引脚放置在Apple的地图应用中,请在URL中使用"q"代替"ll".

你可以像这样使用

 NSString* url = [NSString stringWithFormat:@"http://%@/maps?q=%f,%f", nativeMapScheme, 40.739490, -73.991154];
Run Code Online (Sandbox Code Playgroud)