Results 1 to 3 of 3

Thread: reverseGeocodeLocation fails if I the navigation bar is not translucent

  1. #1
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36

    reverseGeocodeLocation fails if I the navigation bar is not translucent

    iOS 9

    Here's an interesting problem that has eaten up a good chunk of time...

    If I have a translucent navigation bar, the call to
        SKReverseGeocoderService.sharedInstance().reverseG  eocodeLocation

    fails to work. It just returns parent results of
        US and UT

    If the navigation bar is not translucent, the call returns parent results of
        South Jordan, Utah, United States of America, US, UT,


    It took some time to narrow down the code that reproduces this problem. I finally narrowed it down to this:

    Code:
    	override func viewDidAppear(animated: Bool) {
    		super.viewDidAppear(animated)
    
    		let region = SKCoordinateRegion(center: CLLocationCoordinate2DMake(40.702471, -111.903662), zoomLevel: 9)
    		mapView.visibleRegion = region
    
    		let reverseGeoBlock = {
    			let centerCoord = self.mapView.coordinateForPoint(self.mapView.center)
    			let searchObject: SKSearchResult = SKReverseGeocoderService.sharedInstance().reverseGeocodeLocation(centerCoord)
    
    			if let resultParents = searchObject.parentSearchResults as? [SKSearchResultParent] {
    				let truth = self.navigationController?.navigationBar.translucent == true ? "true" : "false"
    				print("Navigation translucent = \(truth). ", terminator: " ")
    				for parent in resultParents {
    					print("\(parent.name)", terminator: ", ")
    				}
    				print("")
    			}
    		}
    
    		reverseGeoBlock()
    
    		self.navigationController?.navigationBar.translucent = false
    		reverseGeoBlock() // bad results
    
    		self.navigationController?.navigationBar.translucent = true
    		reverseGeoBlock() // good results
    
    		self.navigationController?.navigationBar.translucent = false
    		reverseGeoBlock() // bad results
    	}
    If the storyboard has the navigation bar translucent, the above code produces:

    Navigation translucent = true. South Jordan, Utah, United States of America, US, UT,
    Navigation translucent = false. US, UT,
    Navigation translucent = true. South Jordan, Utah, United States of America, US, UT,
    Navigation translucent = false. US, UT,

    If the storyboard has the navigation bar translucent unchecked, the above code produces:

    Navigation translucent = false. US, UT,
    Navigation translucent = false. US, UT,
    Navigation translucent = true. South Jordan, Utah, United States of America, US, UT,
    Navigation translucent = false. US, UT,


    Utah (USUT) is the only map that has been downloaded for offline use.

    I hope the code above has enough info to reproduce this problem.

    I would love to hear if this is a known issue and will be fixed in the upcoming update.

    Thanks!
    Jim

  2. #2
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Hi Jim,

    We'll try to reproduce the problem in our demo app. As soon as we'll have an answer we'll let you know.

  3. #3
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36
    Thanks for looking into this.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •