ios - Contacts framework doesn't request for access when needed -
this have far:
private let contactstore = cncontactstore() private func requestaccessforcontacts() { switch cncontactstore.authorizationstatusforentitytype(.contacts) { case .denied, .notdetermined: contactstore.requestaccessforentitytype(.contacts, completionhandler: { access, error in if access { print("super") } else { print("problem") } }) case .authorized: print("ok") case .restricted: print("restricted") } }
the problem
printed on console, nothing displayed on screen, no request access. why?
your code works; able replicate problem first rejecting access contact , re-running app.
once have disallowed access, subsequent running of app log "problem" without displaying request window.
if 1 wanted see request window again after denying, 1 could, however, go "settings" -> "reset" , click "reset location , privacy" in simulator.
after having done so, next time run app, request window pop again.
Comments
Post a Comment