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?
Contacts
RSS for tagAccess the user's contacts and format and localize contact information using Contacts.
Posts under Contacts tag
44 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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?
Is your feature request related to a problem? Please describe.
Everywhere where Apple offers it, I use Apple's Private Relay e-mail addresses.
However, they can't be manually generated, so for the rest, I use https://anonaddy.me. Because it offers infinite aliases, I use a different alias every time I give my e-mail address to someone. However, I ensure that they're all under the @rokejulianlockhart.anonaddy.com (.com and .me are equivalent in this case) domain so that they can be identified as me by a human. I use different aliases to combat spam, not be anonymous.
Additionally, when messaging others, I ensure that I add a sub-address with my name to their e-mail address so that they can filter all messages from me (even if I'm using a different alias for my own filtering purposes). Others use the same when communicating with me, especially family. The current identification system doesn't take sub-addresses into account whatsoever.
Describe the solution you'd like
I should therefore be able to set
RY7I0I+RY7I0R@rokejulianlockhart.anonaddy.com as an e-mail address, and beneath it add, for instance
[A-Za-z0-9]+\+[A-Za-z0-9]+@rokejulianlockhart\.anonaddy\.com
in another input form to ensure that Nextcloud identifies any (in this case sub-addressed) alias as me.
Describe alternatives you've considered
The sole current alternative is to list literal tens of thousands of aliases as myself, which is insane. It also wouldn't work, because https://anonaddy.me generates a new alias when someone else uses one, so I'd have to retroactively add those whenever someone else uses one. It also wouldn't account for sub-addresses.
Additional context
Like most more powerful features of Nextcloud, this only need be visible when clicked on. Adding a button beside each e-mail address to show a form which allows the user to enter custom regex is enough.
Additionally requested at:
https://feedbackportal.microsoft.com/feedback/idea/ed4261f8-af28-ee11-a81c-6045bd8534ad.
https://discussions.apple.com/thread/255016441.
https://github.com/nextcloud/contacts/issues/3530#issue-1816825315.
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.