2017-04-12 96 views
0

我在使用GoogleMapsSDK時遇到了一個奇怪的問題。在我看來顯示Google Map的視圖中,嵌入了導航控制器。在導航欄上,我有一個連接到新視圖的酒吧按鈕。當按下按鈕時,賽格是滯後的並且不顯示任何內容。iOS - 使用GoogleMaps SDK時出現問題

這裏是正在發生的事情:http://gph.is/2putLtQ

不知道是什麼問題。沒有實施GoogleMapsSDK,我也有相同的設置。

這裏是谷歌地圖視圖控制器:

import UIKit 
import GoogleMaps 

class GoogleMapsViewController: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate { 

    var locationManager = CLLocationManager() 
    var tacoLocations = [TacoLocation]() 
    var tacoLocationPlace_id :String! 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     self.locationManager = CLLocationManager() 
     self.locationManager.delegate = self 
     self.locationManager.desiredAccuracy = kCLLocationAccuracyBest 
     self.locationManager.distanceFilter = kCLDistanceFilterNone 
     self.locationManager.requestWhenInUseAuthorization() 
     self.locationManager.startUpdatingLocation() 

     let lat = self.locationManager.location?.coordinate.latitude 
     let lng = self.locationManager.location?.coordinate.longitude 


     // creates the map and zooms the current user location, at a 15.0 zoom 
     let camera = GMSCameraPosition.camera(withLatitude: lat!, longitude: lng!, zoom: 15.0) 
     let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera) 
     view = mapView 

     for location in self.tacoLocations { 

      let marker = GMSMarker() 

      let lat = location.locationLat 
      let lng = location.locationLng 

      marker.position = CLLocationCoordinate2D(latitude: lat!, longitude: lng!) 
      marker.title = location.name 

      if location.open_now == false { 
       marker.snippet = "\(location.vicinity!)\nClosed" 
      } else if location.open_now == true { 
       marker.snippet = "\(location.vicinity!)\nOpen" 
      } else { 

      } 
      marker.userData = location 

      marker.icon = UIImage(named: "taco_marker.png") 
      marker.infoWindowAnchor = CGPoint(x: 0.5, y: 0.2) 

      marker.map = mapView 
     } 
     // enable my location dot 
     mapView.isMyLocationEnabled = true 
     mapView.delegate = self 

    } 

    //MARK: GMSMapViewDelegate 

    func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? { 
     let customWindow = Bundle.main.loadNibNamed("CustomInfoWindow", owner: self, options: nil)?.first as! CustomInfoWindow 

     customWindow.nameLabel.text = marker.title 
     customWindow.addressLabel.text = marker.snippet 

     return customWindow 
    } 

    func mapView(_ mapView: GMSMapView, didTapInfoWindowOf marker: GMSMarker) { 

     let tacoLocation = marker.userData as! TacoLocation 
     self.tacoLocationPlace_id = tacoLocation.place_id 

     DispatchQueue.main.async { 
      self.performSegue(withIdentifier: "MoreInfoSegue", sender: self) 
     } 
    } 

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 


     if segue.identifier == "MoreInfoSegue" { 


      let tabVC = segue.destination as! UITabBarController 
      let moreInfoVC = tabVC.viewControllers?[0] as! MoreInfoViewController 
      let reviewVC = tabVC.viewControllers?[1] as! ReviewViewController 

      moreInfoVC.tacoLocationPlace_id = self.tacoLocationPlace_id 
      reviewVC.tacoLocationPlace_id = self.tacoLocationPlace_id 

     } else if segue.identifier == "ARSegue" { 

      //segue to new view that is not working correctly. 

     } 

    } 
} 

在第二視圖控制器的唯一事情是viewDidLoad中。

任何幫助非常感謝!

回答

0

我卸載谷歌地圖豆莢,然後重新安裝它們。這解決了我的問題。一定是xcode的一個bug。

相關問題