gpt4 book ai didi

iphone - 使用 Target iOS 5.0 从 iOS SDK 6.1 加载 map 应用程序

转载 作者:行者123 更新时间:2023-11-28 22:39:46 24 4
gpt4 key购买 nike

我想在我使用 iOS 6.1 SDK 编译的应用程序中支持 iOS5。

一个功能是将用户带到 map 应用程序。 Here is a link解释如何使用适用于 iOS 5 的 iOS SDK 5 以及适用于 iOS 6 的 iOS SDK 6。

但是,如果我使用 iOS 6.1 SDK 并使用 iOS 5 设备,magic URL link根据需要,将我带到 Mobile Safari 中的 maps.google.com 网站,而不是本地 map 应用程序。

这可以修复吗?

编辑

到目前为止,我有这个:

BOOL appleMapsSupported = FALSE;
NSString *reqSysVer = @"6.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
appleMapsSupported = TRUE;
if (appleMapsSupported){
NSLog(@"device version %@", [[UIDevice currentDevice] systemVersion]);
MKPlacemark* placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:@{(NSString*)kABPersonAddressStreetKey:@"Your Place"}];
MKMapItem* mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem openInMapsWithLaunchOptions:@{MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeWalking}];
}else{
NSString* url = [NSString stringWithFormat:@"http://maps.google.com/?t=m&q=Your+Place%%40%g,%g", coordinate.latitude, coordinate.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}

最佳答案

Apple 已经更新了他们对 map 的 URL 处理,您需要指向 maps.apple.com,它会适本地重定向到 Google。 See the documentation for more/how .

关于iphone - 使用 Target iOS 5.0 从 iOS SDK 6.1 加载 map 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14900304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com