ios – WKInterfaceMap不加载地图

前端之家收集整理的这篇文章主要介绍了ios – WKInterfaceMap不加载地图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在构建一个Apple Watch应用程序,应该将一个引脚放在地图位置,我正在使用 Xcode模拟器,但地图只是不加载…

enter image description here

这是我的示例代码,还有其他一些我缺少的设置?

import WatchKit
import MapKit

class MapController: WKInterfaceController {

    @IBOutlet var map: WKInterfaceMap!

    override func awakeWithContext(context: AnyObject?) {
        super.awakeWithContext(context)

        let centerOfMap = CLLocationCoordinate2D(latitude: -3.743205,longitude: -38.514871)
        let pinPosition = CLLocationCoordinate2D(latitude: -3.65,longitude: -38.514871)
        let coordinateSpan = MKCoordinateSpanMake(1,1)

        self.map.addAnnotation(pinPosition,withPinColor: .Red)
        self.map.setRegion(MKCoordinateRegion(center: centerOfMap,span: coordinateSpan))
    }
}

解决方法

它不会为模拟器加载地图图块.你必须在实际的手表上进行测试.

猜你在找的Xcode相关文章