Contacts

RSS for tag

Access the user's contacts and format and localize contact information using Contacts.

Posts under Contacts tag

39 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Localized language not getting deleted
I'm trying to remove a few languages which is present as the localized language in my app (under language section) in iTunes connect but when I try to remove it, it allows me to remove but when I try to save these changes Apple is prompting me an error message "You have one or more errors on this page. • An error has occurred. Try again later." Can anyone, please let me know how can I remove a localized language?
2
0
1.1k
Nov ’23
Is it possible for EventKit Framework to trigger the Permission Alert of the Contacts?
We use Eventkit Framework to synchronize the meeting calendar to the system calendar, read the System Calendar with -[EKEventStore calendarsForEntityType:], Use - [EKEventStore saveEvent: span: commit: error:] wrote system calendar. This usage currently triggers the Contacts Permission Alert on a user. Through the log, we identified no use - [CNContactStore requestAccessForEntityType: completionHandler:] and Contacts API.
1
0
953
Jan ’24
iOS 17 Beta 4: CNContactViewController can't be dismissed
After presenting a CNContactViewController to create a new contact once I open the image editor and instead of going through the whole flow I decide the cancel it once I get back to my contact VC the cancel and done buttons are gone and I have no way to dismiss the contact info. Note: If you do go through setting an image at the end of the flow once you are back to the contacts VC the buttons are enabled again and the VC can be dismissed. Here's a quick code example of the presentation logic. This is all this app did. class ViewController: UIViewController { let button = UIButton(primaryAction: UIAction(handler: { _ in self.presentContacts() })) func presentContacts() { let mutableContact = CNMutableContact() let newPhone = CNLabeledValue(label: CNLabelPhoneNumberMobile, value: CNPhoneNumber(stringValue: "randomnumberhere")) mutableContact.phoneNumbers += [newPhone] let cont = CNContactViewController(forUnknownContact: mutableContact) cont.contactStore = CNContactStore() cont.allowsActions = false cont.isEditing = true cont.delegate = self let nav = UINavigationController(rootViewController: cont) nav.modalPresentationStyle = .fullScreen let navBarAppearance = UINavigationBarAppearance() navBarAppearance.configureWithTransparentBackground() nav.navigationBar.standardAppearance = navBarAppearance nav.navigationBar.scrollEdgeAppearance = navBarAppearance self.navigationController?.present(cont, animated: true) } } extension ViewController: CNContactViewControllerDelegate { func contactViewController(_ viewController: CNContactViewController, shouldPerformDefaultActionFor property: CNContactProperty) -> Bool { return false } func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { viewController.dismiss(animated: true) } }
0
0
716
Jul ’23
Find the name of a CNContact's group (CNGroupName)
So I only recently uncovered the Contacts Framework through this video: https://youtu.be/sHKir2ZMk5Q. As such I'm not yet accustomed to the API. Basically my main problem is that I can't seem to find a way to access the name of the group a CNContact is in. The only support I can find is in Apple's own documentation, which isn't very helpful. if someone could point me in the right direction towards how to print the group name, I would be very grateful. My code is below, Cheers // ModelData.swift // B-Day import Foundation import Contacts import SwiftUI struct Contact: Identifiable { let id = UUID() let category: String let firstName: String let lastName: String let birthday: DateComponents? } func fetchAllContacts() async -> [Contact] { var contacts = [Contact]() let store = CNContactStore() let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactBirthdayKey, CNContactIdentifierKey, CNGroupNameKey] as [CNKeyDescriptor] let fetchRequest = CNContactFetchRequest (keysToFetch: keys) do { try store.enumerateContacts(with: fetchRequest, usingBlock: { contact, result in //this should print the name of the contact's group print(contact.groupName) contacts.append(Contact(category: contact.groupName, firstName: contact.givenName, lastName: contact.familyName, birthday: contact.birthday)) }) } catch { print("Error") } return contacts }
1
0
702
Nov ’23
CNSocialProfileService missing some services
The application I am creating is using CNContact() and I am trying to attach an Instagram profile. There currently is no CNSocialProfileService for Instagram. Does anyone know of a way to do so? Currently I have: let socialProfile = CNLabeledValue(label: social.service, value: CNSocialProfile(urlString: "https://www.instagram.com/" + social.username, username: social.username, userIdentifier: nil, service: "Instagram")) That works but when it saves to contacts it creates a Custom Service and then capitalizes the service name and the username.
0
0
444
Aug ’23
How do I highlight a property in CNContactViewCotnroller?
The documentation for hightlightProperty(withKey:identifier:) describes the parameter "key" as the "Key of the property to highlight." I believe that refers to the CNKeyDescriptor, such as CNContactGivenNameKey, which can cast from a type CNKeyDescriptor to String. The documentation for identifier is "the value to highlight". I believe an example of that would be "John" as the given name. Am I correct about all this? In any case, I'm not able to highlight an email property when I use CNContactEmailAddresses as the key, and an actual email address as the identifier. I have also tried using the identifier property of CNLabeledValue, which is how an email address is stored. I can't find anything on the internet to explain this. I didn't even find a similar question, except my own question asking this exact same question about two months ago. Anyone have any idea or a good answer for this?
0
0
480
Aug ’23
Base64 CNContact identifier with CNSuggestedContactStore prefix
On our backend we detected imported contacts with strange identifiers, that looks like CNSuggestedContactStore://YnBsaXN0MDDUAQIDBAUGBwpYJHZlc...AAA. Inside of base64 encoded strictly service information like $archiver, CF$UID, internalEntityId, SGRecordId, $classname. I think that contact identifier always should be in uuid format isn't it? Do somebody know what this contacts are and how to obtain them for debug?
2
1
560
Sep ’23
Is it possible to fetch contacts from CNContactStore using custom predicate?
I've been working with swift and swiftui for about a year (but I'm old so not so swift (sorry)). I am trying to construct a predicate other than those supplied in the framework (i.e., name, email, phone) to fetch contacts having a specific value in their socialProfiles. For example, I want to fetch all contacts having a urlString that contains a specific value. I've finding the documentation on NSPredicate to be a bit daunting, especially since I have never used Objective-C, only swift. I think the problem is I don't know how to refer to the socialProfiles value in the predicate format string, nor what operators I should be using to filter. I'm sure the code below is totally wrong, and I'm not sure it can even be done, but to help illustrate what I'm trying to do: keys = [CNContactSocialProfilesKey] as [CNKeyDescriptor] predicate = NSPredicate(format: "SELF.socialProfile.value.urlString contains %@", value) do { let contacts = try store.unifiedContacts(matching: predicate, keysToFetch: keys) return contacts } Any suggestions would be appreciated, including: "You can't do that...you've got to retrieve all the contacts and filter them yourself"
1
0
481
Oct ’23
High CPU time for searchpartyd w/ associated sandbox restriction errors for contactsd.persistence
This has been happening from 14.0 DB4 and has continued up to 14.2 DB1. Occurring on M2 MBA 13 and M2 MBP 16. The principle thing I noticed was searchpartyd running a bit more than one would expect. I understand this is a FindMy daemon. For context, it does a low level 2-5% CPU constantly, and is the number 3 ranked CPU Time process on both machines. In the launchd console log the following errors appear on continuous repeat: 2023-10-28 12:36:49.662855 (gui/501 [100017]) : denied lookup: name = com.apple.contactsd.persistence, requestor = Family[6697], error = 159: Sandbox restriction 2023-10-28 12:36:49.757132 : Last log repeated 1 times 2023-10-28 12:36:49.757107 (gui/501 [100017]) : denied lookup: name = com.apple.contactsd.persistence, requestor = searchpartyuser[6696], error = 159: Sandbox restriction 2023-10-28 12:36:51.307002 : Last log repeated 1 times 2023-10-28 12:36:51.306944 (gui/501 [100017]) : denied lookup: name = com.apple.contactsd.persistence, requestor = imagent[702], error = 159: Sandbox restriction For context: I do not have Family Sharing set up.
0
1
777
Oct ’23
iCloud contact API "https://api.icloud.com/contacts/v1/me/contacts" is not working for accessing contacts information.
I'm able to get the access token by utilizing the "https://appleid.apple.com/auth/token" API. However, when obtaining contact data from the iCloud API at "https://api.icloud.com/contacts/v1/me/contacts" using the same access token. I'm not getting any response. I'm not sure whether the API is operational and live. Or please suggest if there any other API for fetching iCloud contacts. Additionally, I consistently receive a "invalid_scope" error when utilizing scope contacts with the "https://appleid.apple.com/auth/authorize" API.
0
0
756
Nov ’23
watchOS CNSaveRequest not-supported
I have this issue FB13432607 where watchOS synced iCloud contacts just grow and grow and grow: I'm currently over 9 GB of contacts with many duplicate entries. iOS, iPadOS and macOS are also syncing the same iCloud contact store, and they're not showing this issue. I've been reporting feedback for some time, but then I thought, hey, I'm a developer, I can write a watchOS app! After the initial elation and some quick prototyping (it's not a huge amount of code), I came to see that CNSaveRequest is NOT supported on watchOS, which means I can't delete my contacts. (The other option is nuclear: erase all data, restore and re-sync). So writing an app is out, due to lack of API access. Which got me wondering: is my contact store growing because Apple also doesn't have an API to delete contacts on watchOS? If so, this is a huge issue. Any ideas?
1
0
437
Dec ’23
How can I access contacts using Mac CLI app (XCode 14)?
I'm having some problems accessing contacts inside of mac cli app. The main issue is that the app is not triggering a dialog requesting access to contacts. Some sources state that NSContactsUsageDescription should be added to info.plist. This info.plist is nowhere to be found inside the project in xcode. Then, some sources are stating that there was a xcode update, and now permissions are added on Targets -> Info tab, but this tab does not exist on mac cli project. Here is a code snippet: #import <Contacts/Contacts.h> int main(int argc, const char * argv[]) { @autoreleasepool { CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; if (status == CNAuthorizationStatusNotDetermined) { NSLog(@"Contact access not determined."); CNContactStore *contactStore = [[CNContactStore alloc] init]; [contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) { NSLog(@"Got response"); }]; } else if (status == CNAuthorizationStatusAuthorized) { NSLog(@"Access granted"); } else { NSLog(@"Access to contacts is denied or restricted."); } } return 0; } Running this outputs: Contact access not determined. and app exits with code 0. How would one access contacts inside of mac cli app project? Or setup proper permissions so that dialog would trigger? PS. I have also tried adding info.plist manually, but there was no difference. Maybe I did something wrong? Is info.plist even used in mac cli project?
1
0
606
Jan ’24
We’re unable to make this call.
Dear Madam, Sir, I would like to ask why I can not have telephone call back for account and service and it says the red message as : We’re unable to make this call. Please reach out to us by email. Could you please guide me why I can not have telephone call support with call back for membership and account services ( before I use to be able to have call back in this section but now it says : We’re unable to make this call. Please reach out to us by email.). what should I do ? I can not also submit email form because the submit button does not work for my account ! Thank you so much Best Regards
0
0
479
Jan ’24
Selecting Default Voice Line does not work
I am on iOS 17.2.1 Device: iPhone 15 Pro Sims: 1. Physical SIM (Secondary SIM) 2. eSIM (Primary SIM) In my phone settings, I have set the Default Voice Line to be 2. eSIM. This does not over ride the default Preferred Line that has got defined automatically for each contact. I have over 1000 contacts listed and its not at all feasible to open each saved contact and update the preferred line. This is in fact a bug and should be remediated so that the settings phone level should take the precedence.
2
1
654
Jan ’24