From dc75e592c1a3fb2d09739c95724150290578f8ed Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 8 May 2017 15:50:12 -0400 Subject: [PATCH] ensure contact callback on proper thread // FREEBIE --- Signal/src/contact/SystemContactsFetcher.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Signal/src/contact/SystemContactsFetcher.swift b/Signal/src/contact/SystemContactsFetcher.swift index efd70531d..2b4794767 100644 --- a/Signal/src/contact/SystemContactsFetcher.swift +++ b/Signal/src/contact/SystemContactsFetcher.swift @@ -51,18 +51,21 @@ class SystemContactsFetcher: NSObject { switch authorizationStatus { case .notDetermined: - contactStore.requestAccess(for: .contacts, completionHandler: { (granted, error) in + contactStore.requestAccess(for: .contacts) { (granted, error) in if let error = error { Logger.error("\(self.TAG) error fetching contacts: \(error)") assertionFailure() } - if !granted { + guard granted else { Logger.info("\(self.TAG) declined contact access.") - } else { + return + } + + DispatchQueue.main.async { self.updateContacts() } - }) + } case .authorized: self.updateContacts() case .denied, .restricted: