简体   繁体   English

iOS模拟器地图不起作用

[英]iOS Simulator Maps not working

I'm trying to get a map up and running in one of my apps and for some reason, maps are not working at all.我正在尝试在我的一个应用程序中启动并运行地图,但由于某种原因,地图根本无法使用。 In my app, I just get a blank image of the grid that shows when maps load and it never loads the map.在我的应用程序中,我只得到一个空白的网格图像,显示何时加载地图,但它从不加载地图。

I tried running the stock Apple Maps app on the simulator, as well, and I am having the same problem.我也尝试在模拟器上运行股票 Apple Maps 应用程序,但我遇到了同样的问题。

Does anybody have any ideas?有人有任何想法吗?

I hope you have followed the following steps:我希望您已遵循以下步骤:

  1. MapView in Interface Builder, connect the map view to the MapView controller swift file. Interface Builder 中的 MapView,将地图视图连接到MapView控制器 swift 文件。
  2. Just above the mapcenterpinimage property.就在mapcenterpinimage属性上方。 A popup will appear;将出现一个弹出窗口; set the connection type to Outlet and the name to MapView .将连接类型设置为 Outlet 并将名称设置为MapView
  3. Once you have created the Outlet, request the user location, i.elet l ocationManager = CLLocationManager()创建 Outlet 后,请求用户位置,i.elet ocationManager = CLLocationManager()
  4. View did load call these code View did load调用这些代码

locationManager.delegate = self locationManager.requestWhenInUseAuthorization() locationManager.delegate = self locationManager.requestWhenInUseAuthorization()

You can also follow the below tutorial link, which I found to be very useful.你也可以按照下面的教程链接,我发现它非常有用。 http://www.raywenderlich.com/81103/introduction-google-maps-ios-sdk-swift could be pl. http://www.raywenderlich.com/81103/introduction-google-maps-ios-sdk-swift可能是 pl。 checkout the below stack overflow I have details to support, apple map in Swift.结帐下面的堆栈溢出我有详细信息要支持,Swift 中的苹果地图。

Just make sure Location is enable from只需确保位置启用

Simulator options Features->Location->Apple模拟器选项功能->位置->苹果

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM