xcode - 为什么 watchOS 5 应用程序中的地图不显示在模拟器中?
问题描述
我想在 watchkit 应用程序中显示地图。当我使用下面的代码时,我可以看到我的 pin 注释,但看不到地图本身。请参阅图片以获取说明。
我正在运行 Xcode 10.2.1。这个版本我只能在模拟器上运行,因为这个版本的 Xcode 不能在我的系列 4 手表上运行。请在下面查看我的代码:
override func willActivate() {
super.willActivate()
location.latitude = (CLLocationDegrees(lat))
location.longitude = (CLLocationDegrees(lon))
locationManager = CLLocationManager()
let spanX: Float = 0.005
let spanY: Float = 0.005
region.center = location
region.span.latitudeDelta = CLLocationDegrees(spanX)
region.span.longitudeDelta = CLLocationDegrees(spanY)
stationMap.setRegion(region)
stationMap.addAnnotation(location, with: .red)
}
我可能会丢失或错误地调用地图。
解决方案
推荐阅读
- signal-processing - 复数乘法指令Hexagon DSP
- java - 带有java模块的springframework ldap核心问题
- asp.net - 无法加载模板:(HTTP 状态:未定义未定义)在 ASP.Net 中的捆绑缩小后
- c++ - 结构中的 C/C++ 指针
- c - 我的代码中有多个错误,我不明白
- dafny - 如何在 Dafny 中验证前置/后置条件
- rust - nightly-x86_64-pc-windows-gnu 错误读取 rustc 版本
- windows - 如何杀死进程在Windows中每隔一秒重复一次?
- git - git checkout HEAD -- 之间有区别吗?和 git reset --hard HEAD?
- python - 合并两个排序列表返回运行时错误