2017-03-26 36 views
5

Bu hatayı kodumla alıyorum ve google eğitim talimatlarını adım adım takip ettim.Seçim Yeri Hatası - Google Rehber API'si

Pick Place error: The operation couldn’t be completed. The Places API could not find the user's location. This may be because the user has not allowed the application to access location information. 

Ben Info.plist ilgili bilgileri eklemiş ve benim kod şöyle görünür -

import UIKit 
import GooglePlaces 

class ViewController: UIViewController { 

    var placesClient: GMSPlacesClient! 

    @IBOutlet var nameLabel: UILabel! 
    @IBOutlet var addressLabel: UILabel! 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     let locationManager = CLLocationManager() 
     locationManager.requestWhenInUseAuthorization() 
     locationManager.startUpdatingLocation() 
     placesClient = GMSPlacesClient.shared() 
    } 

    @IBAction func getCurrentPlace(_ sender: UIButton) { 


     placesClient.currentPlace(callback: { (placeLikelihoodList, error) -> Void in 
      if let error = error { 
       print("Pick Place error: \(error.localizedDescription)") 
       return 
      } 

      self.nameLabel.text = "No current place" 
      self.addressLabel.text = "" 

      if let placeLikelihoodList = placeLikelihoodList { 
       let place = placeLikelihoodList.likelihoods.first?.place 
       if let place = place { 
        self.nameLabel.text = place.name 
        self.addressLabel.text = place.formattedAddress?.components(separatedBy: ", ") 
         .joined(separator: "\n") 
       } 
      } 
      } 
     ) 
    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 



} 

izin ile konum pencere/inkar çok hızlı ve ben izin bastığımda bile hiçbir şey olmuyor kaybolur Google dokümanı izlediğimde bunu nasıl çözeceğimi bilmiyorum.

Ayrıca bu hata görünür -

2017-03-26 14:38:27.472739 Restaurant[26616:2797750] subsystem: com.apple.BackBoardServices.fence, category: Observer, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0 

cevap

0

Eğer https://console.developers.google.com üzerinde istek sınırını kontrol etmeliyiz, ücretsiz sürümü onun günde, ben başka bir proje ve tutmak testleri için yeni bir anahtar oluşturmak zorunda sadece 1000.