{"id":21768138,"url":"https://github.com/below/revgeotest","last_synced_at":"2025-08-01T19:34:32.319Z","repository":{"id":66512612,"uuid":"77156776","full_name":"below/RevGeoTest","owner":"below","description":"A sample project for CLGeocoder","archived":false,"fork":false,"pushed_at":"2016-12-22T16:15:38.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T05:43:53.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/below.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-22T15:49:08.000Z","updated_at":"2016-12-22T16:14:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"e81fa4ca-ac32-4200-989f-84325c1d492e","html_url":"https://github.com/below/RevGeoTest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/below/RevGeoTest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FRevGeoTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FRevGeoTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FRevGeoTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FRevGeoTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/below","download_url":"https://codeload.github.com/below/RevGeoTest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/below%2FRevGeoTest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268287609,"owners_count":24226390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T13:33:46.940Z","updated_at":"2025-08-01T19:34:32.294Z","avatar_url":"https://github.com/below.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RevGeoTest\n\n\n## What am I ultimately trying to achive?\n\nFor an app, I need to reverse-geocode two different locations in one view. The locations arrive asynchronously, so I can not say if, when, or in which order they arrive.\n\n## What is the problem?\n\nWhen I implemented the call for the second location, `reverseGeocodeLocation` never called its completion block. \n\n## What did I try to fix the problem?\n\nSo I looked to the [CLGeocoder documentation](https://developer.apple.com/reference/corelocation/clgeocoder/1423621-reversegeocodelocation) and found this:\n\n\u003e After initiating a reverse-geocoding request, do not attempt to initiate another reverse- or forward-geocoding request.\n\nI tried to remedy this by executing my `reverseGeocodeLocation` calls serially on a `DispatchQueue`, and using a `DispatchSemaphore` to block the queue execution until completion block is called. It looks like this (the code is in `getGeolocation` in `ViewController.swift`):\n\n```swift\ngeocodingQueue.sync {\n    let semaphore = DispatchSemaphore(value: 0);\n    \n    geocoder.reverseGeocodeLocation(location, completionHandler: { (placemarkArray, error) in\n        semaphore.signal()\n        completionHandler(placemarkArray, error)\n    })\n    semaphore.wait()\n}\n```\n## Why didn't that fix it?\n\nIf I call `semaphore.wait()`, the completion handler of `reverseGeocodeLocation` is never called. If I don't call `wait()`, the handler will be called, but of course that would not prevent me from executing another query on this queue — which is what I tried to prevent.\n\n## What can you do?\n\nAm I doing it wrong? The `DispatchQueue`/`DispatchSemaphore` works perfectly for other situations, so I assumed it works here. Or is there something else I overlooked?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelow%2Frevgeotest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelow%2Frevgeotest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelow%2Frevgeotest/lists"}