我正在尝试使用MapBox在XCode中打开一个简单的地图。构建成功,但是模拟器只是一个带有mapbox徽标的黑屏,底部是i,没有地图加载。
模拟器
当我单击i时,我可以选择接受以使Mapbox更好。
这是我收到的错误
错误
2018-09-21 19:14:40.602675-0600 MyApp [6440:163676]任务。<1>完成,错误-代码:-1002 2018-09-21 19:14:40.607725-0600 MyApp [6440:163676]任务<5FAF9245-6D0F-4E85-A71D-9301AEDC9961>。<2>已完成,错误-代码:-1002 2018-09-21 19:14:40.613121-0600 MyApp [6440:163676]任务<5BD45724-540E-4013-A791-58FD205C12A5>。<1>已完成,错误-代码:-1002 2018-09-21 19:14:40.624911-0600 MyApp [6440:163676]任务<184ADD8B-5960-4A4A-BC46-96B242FE312F>。<3>已完成,错误-代码:-1002 2018-09-21 19:14:40.625523-0600 MyApp [6440:163676]任务<81EC417B-2515-4C1D-82B3-2D4F7E8DFF19>。<4>已完成,错误-代码:-1002 2018-09-21 19:14:40.650401-0600 MyApp [6440:163676]任务<8EE70CCC-25AD-499B-8C56-0E62DB086DA5>。<2>已完成,错误-代码:-1002 2018-09-21 19:14:40.662595-0600 MyApp [6440:163559] [INFO] {} [常规]:GPU标识符:Apple Software Renderer 2018-09-21 19:14:40.987888-0600 MyApp [6440:163559] [错误] {} [设置]:加载样式失败:不支持的URL 2018-09-21 19:14:40.996777-0600 MyApp [6440:163559] [错误] {} [设置]:加载样式失败:不支持的URL 2018-09-21 19:14:42.122724-0600 MyApp [6440:163642] [] nw_proxy_resolver_create_parsed_array PAC评估错误:kCFErrorDomainCFNetwork:308
这是我的代码
viewcontroller.swift
导入Mapbox
ViewController类:UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "mapbox://styles/mapbox/streets-v10")
let mapView = MGLMapView(frame: view.bounds, styleURL: url)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mapView.setCenter(CLLocationCoordinate2D(latitude: 59.31, longitude: 18.06), zoomLevel: 9, animated: false)
view.addSubview(mapView)
}
}