cllocationmanager - CLLocation manager not working iOS 8 -


i'm trying follow google maps tutorial: http://www.raywenderlich.com/81103/introduction-google-maps-ios-sdk-swift

like many others have hit roadblock cllocationmanager not seem fire startupdatinglocation().

i have updated plist nslocationalwaysusagedescription , nslocationwheninuseusagedescription in accordance location services not working in ios 8, still no location being fired.

code below - appreciated!

import uikit  class mapviewcontroller: uiviewcontroller, typestableviewcontrollerdelegate, cllocationmanagerdelegate {      @iboutlet weak var mapview: gmsmapview!     @iboutlet weak var mapcenterpinimage: uiimageview!     @iboutlet weak var pinimageverticalconstraint: nslayoutconstraint!     var searchedtypes = ["bakery", "bar", "cafe", "grocery_or_supermarket", "restaurant"]     let locationmanager = cllocationmanager()      override func viewdidload() {         super.viewdidload()         locationmanager.delegate = self         locationmanager.requestwheninuseauthorization()     }      override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {         if segue.identifier == "types segue" {             let navigationcontroller = segue.destinationviewcontroller uinavigationcontroller             let controller = segue.destinationviewcontroller.topviewcontroller typestableviewcontroller             controller.selectedtypes = searchedtypes             controller.delegate = self         }     }      // mark: - types controller delegate     func typescontroller(controller: typestableviewcontroller, didselecttypes types: [string]) {         searchedtypes = sorted(controller.selectedtypes)         dismissviewcontrolleranimated(true, completion: nil)     }      func locationmanager(manager: cllocationmanager!, didchangeauthorizationstatus status: clauthorizationstatus) {          if status == .authorizedwheninuse {             println("success") // works             locationmanager.startupdatinglocation() // not seem fire              mapview.mylocationenabled = true             mapview.settings.mylocationbutton = true         }     }      func locationmanager(manager: cllocationmanager!, didupdatelocations locations: [anyobject]!) {         println("test") // not work         println(locations.count) // not work          if let location = locations.first as? cllocation {              mapview.camera = gmscameraposition(target: location.coordinate, zoom: 15, bearing: 0, viewingangle: 0)              locationmanager.stopupdatinglocation()         }     }   } 

unbelievable. after day of testing found solution.. code fine. simulation requires change location

steps:

  1. in xcode simulator --> debug --> location --> apple (or whatever..)
  2. re-run simulation

google map centered on chose in simulation settings (xcode --> edit scheme --> allow simulation + default location = new york)

hope helps else!


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -