我有一个变量,目的地,我需要用引脚打开原生Apple Maps才能到达目的地.我已经尝试过这里解答的解决方案:Phonegap - 在Apple Maps App中打开导航方向,但是没有用.如果我在测试时通过浏览器到达"maps://xx.xxxx,yy.yyyy",则会打开"unsafe:/ maps://xx.xxxx,yy.yyyy".它没有固定地图,它从未指向我选择的目的地.我该如何解决这个问题?
我正在尝试使用MapKit构建一个简单的应用程序,该应用程序将在应用程序启动时自动搜索特定位置,并在地图上的地点放置引脚.我看到了各种加载位置的方法(lat/lon等),但没有任何东西可以让我搜索特定的商家名称,餐馆名称等.
我期待与Apple Maps合作.但是,如果谷歌地图是一个比它更好的解决方案.
任何帮助,将不胜感激.谢谢
我regionDidChangeAnimated用于我的mapView.我想检测用户缩放或拖动地图的时间.正在检测拖动,但我似乎无法检测用户缩放地图的时间.我试着用:
func mapView(mapView: MKMapView, regionWillChangeAnimated animated: Bool) {
print("region will change")
}
Run Code Online (Sandbox Code Playgroud)
但是当我缩放我的地图时,它不起作用.
完整代码:
var locationManager: CLLocationManager = CLLocationManager()
var startLocation: CLLocation!
@IBOutlet weak var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
//get current location
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
self.mapView.showsUserLocation = true
startLocation = nil
let mapDragRecognizer = UIPanGestureRecognizer(target: self, action: "didDragMap:")
mapDragRecognizer.delegate = self
self.mapView.addGestureRecognizer(mapDragRecognizer)
self.mapView.pitchEnabled = true
self.mapView.showsBuildings = true
}
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [CLLocation]) {
let location = locations.last …Run Code Online (Sandbox Code Playgroud) 我想在用户点击链接时在我的PhoneGap应用中打开Apple Maps.Apple文档中的URL方案就像http://maps.apple.com/maps?ll=51.83733,-8.3016打开Apple Maps 一样,如果它存在,则重定向到Google Maps.但是当我点击此链接时,它会打开谷歌地图Web应用程序,而无法返回应用程序.
寻找解决方案,我发现了这个问题 - Phonegap - Apple Maps App中的开放式导航方向
它建议使用maps:而不是http://maps.apple.com/?q=somePlaceName.这很好,并打开原生Apple Maps应用程序.但我想传递纬度和经度而不是地名.
我尝试过maps?ll:51.84,-8.30,但它不起作用.
我正在尝试获取用户当前位置和预定义目的地之间的估计时间和距离,但我找不到解决方法。我知道flutter现在有地图插件-flutter maps,但我不需要显示地图,只需使用map api计算估计的旅行时间和距离。类似于MKDirections。我想念什么吗?有什么办法吗?
我为哥本哈根的自行车手制作了一个应用程序,但遇到了一些麻烦.当手机上没有Google地图时,该应用需要打开Apple地图.
代码看起来像这样
// OUTLETS!
@IBOutlet weak var googleMapsView: GMSMapView!
// VARIABLES!
var locationManager = CLLocationManager()
var M1: GMSMarker!
var M2: GMSMarker!
//Marker funtioncs
var markerFunctions: [GMSMarker: (() -> Void)]!
override func viewDidLoad() {
super.viewDidLoad()
// GET LOCATION WHILE USING APP
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
locationManager.startMonitoringSignificantLocationChanges()
initGoogleMaps()
}
// START GOOGLE MAPS!
func initGoogleMaps() {
// MARKERS
M1 = GMSMarker()
M1.position = CLLocationCoordinate2D(latitude: 55.65208178045790, longitude: 12.527047696518300)
M1.title = "Sjælør St."
M1.snippet = "Press for navigation"
M1.map = …Run Code Online (Sandbox Code Playgroud) apple-maps ×9
ios ×5
iphone ×4
swift ×4
google-maps ×3
mapkit ×3
cordova ×2
api ×1
flutter ×1
ios6 ×1
maps ×1
mkmapview ×1
objective-c ×1
swift3 ×1