Created
December 24, 2019 05:24
-
-
Save monsoir/d581d0d9b4317084c9815a73938992c8 to your computer and use it in GitHub Desktop.
Contacts Extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CNContactStore { | |
/// 是否可以访问通讯录 | |
/// - true 表示可访问,false 表示未知或不可访问 | |
class var canAssessContact: Bool { | |
return CNContactStore.authorizationStatus(for: .contacts) != .denied | |
} | |
class var maybeCanAccessContact: Bool { | |
return CNContactStore.authorizationStatus(for: .contacts) == .notDetermined | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment