스트리밍은 대부분의 브라우저와
Developer 앱에서 사용할 수 있습니다.
-
Contact Access Button 소개
새로운 연락처 승인 모드에 대해 알아보고, 앱에서 연락처 접근을 향상하는 방법을 확인해 보세요. Contact Access Button을 앱에 통합하여 요청에 따라 추가 연락처를 공유하고 간편한 연락처 승인 방법을 제공하는 방법을 살펴보세요. 또한 Contact Access Button이 앱에 적합하지 않은 경우 사용할 수 있는 대체 API와 연락처 보안 기능도 설명합니다.
챕터
- 0:00 - Introduction
- 0:36 - Limited Access
- 2:56 - Contact Access Button
- 8:28 - Accessing contacts
- 13:34 - Which access method to use
리소스
-
다운로드Array
-
-
5:15 - Using ContactAccessButton
// Using ContactAccessButton @Binding var searchText: String @State var authorizationStatus: CNAuthorizationStatus = .notDetermined var body: some View { List { ForEach(searchResults(for: searchText)) { person in ResultRow(person) } if authorizationStatus == .limited || authorizationStatus == .notDetermined { ContactAccessButton(queryString: searchText) { identifiers in let contacts = await fetchContacts(withIdentifiers: identifiers) dismissSearch(withResult: contacts) } } } }
-
6:10 - Appearance options
ContactAccessButton(queryString: searchText) .font(.system(weight: .bold)) .foregroundStyle(.gray) .tint(.green) .contactAccessButtonCaption(.phone) .contactAccessButtonStyle(ContactAccessButton.Style(imageWidth: 30))
-
10:11 - Fetching contacts with CNContactStore
// Fetching contacts with CNContactStore func fetchContacts(withIdentifiers identifiers: [String]) async -> [CNContact] { return await Task { let keys = [CNContactFormatter.descriptorForRequiredKeys(for: .fullName)] let fetchRequest = CNContactFetchRequest(keysToFetch: keys) fetchRequest.predicate = CNContact.predicateForContacts(withIdentifiers: identifiers) var contacts: [CNContact] = [] do { try CNContactStore().enumerateContacts(with: fetchRequest) { contact, _ in contacts.append(contact) } } catch { // ... } return contacts }.value }
-
12:47 - Using contactAccessPicker
// Using contactAccessPicker @State private var isPresented = false var body: some View { Button("Show picker") { isPresented.toggle() }.contactAccessPicker(isPresented: $isPresented) { identifiers in let contacts = await fetchContacts(withIdentifiers: identifiers) // use the new contacts! } }
-
-
찾고 계신 콘텐츠가 있나요? 위에 주제를 입력하고 원하는 내용을 바로 검색해 보세요.
쿼리를 제출하는 중에 오류가 발생했습니다. 인터넷 연결을 확인하고 다시 시도해 주세요.