Hello all,So I am working on our app that uses the Contacts database. Of course we need to ask for permission to access the database. In order to test this I need to reset the tcc database, using tccutil, however it does reset the system, so I cannot retest the ask for permissions.I am running on 10.15.3 for the moment on two different systems. The app only exists in one location (I had an issue with this previously, but I seemed to fix it by ensuring there was only one copy of the app on the machine). Both machines do have SIP disabled (due to some other development that I regularly do that needs SIP disabled), but I did try reenabling it and reseting the database, but that did not work either.When I looked at the tcc.db itself (getting desparate), I don't see either my app, nor the other apps that have AddressBook access.I would really appreciate any help with this issue – it is getting very frustrating.Thanks,Scott Little
Post
Replies
Boosts
Views
Activity
I am trying to allow the user to save a set of files (generated from my app) into a folder chosen by the user via the NSOpenPanel API, but am constantly getting errors that the end URL (with the folder URL and appended file name) cannot be written to.
I am not doing this across app sessions, so I can see why I should need Security Scope management, but I have been trying that and am just not sure where it should be used, if so.
On previous os versions it seems I could have simply appended my file name and write the file. I haven't found any examples of how this should be done anywhere that are recent.
Here is what I am currently doing:
URLList contains list of temporary file URLs.
NSOpenPanel * openPanel = NSOpenPanel.openPanel;
openPanel.prompt = MVNLocalizedString(@"SAVE");
openPanel.canCreateDirectories = YES;
openPanel.canChooseFiles = NO;
openPanel.canChooseDirectories = YES;
openPanel.allowsMultipleSelection = NO;
[openPanel beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse result) {
if ((result == NSModalResponseOK) && openPanel.URL) {
NSURL * locationURL = openPanel.URL;
BOOL accessed = [locationURL startAccessingSecurityScopedResource];
NSFileManager * manager = [NSFileManager new];
for (NSURL * aURL in URLList) {
NSURL * newFileURL = [locationURL URLByAppendingPathComponent:aURL.lastPathComponent];
NSError * error = nil;
if (![manager copyItemAtURL:aURL toURL:newFileURL error:&error]) {
NSLog(@"There was an error saving a file: %@", error);
}
}
[locationURL stopAccessingSecurityScopedResource];
}
}];
My calling of the startAccessingSecurityScopedResource is me attempting to make that work, but doesn't seem correct to me. It doesn't work with or without that though.
Can anyone tell me what I am doing wrong here?
Thanks,
Scott
In my project, when I try to build, one of my many packages is crashing the linker:
can't find atom for stabs BNSYM at 000273FC in /Users/scott/Library/Developer/Xcode/DerivedData/MailMaven-ahgcnebtfdhjorasdlhlivramzrp/Build/Products/Debug/SCBaseTagKit.o
clang: error: unable to execute command: Segmentation fault: 11
The same project builds fine within Xcode 13.3, but in 14.0 (betas 1 & 2) it crashes.
I have tried cleaning many times & deleting the derived data with no change.
Does any one know what this means and what I might be able to do to fix it? Searching for any of this in many different ways has turned up nothing helpful at all.
Thanks in advance,
Scott
Hello,
While testing my app I want to be able to retry the workflow of doing the first request for the User Notifications, but I cannot find a way to reset that information.
tccutil All [bundle id] did not work for me, so I am assuming that there might be another way to do this, but I have not been able to find it.
Since you are here looking, one of the other reasons I want to do this, is that I am getting this error when I actually try to send a local notification, even when the app has proper access given:
Error sending notification: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 586 named com.apple.usernotifications.usernotificationservice"
Thanks for any help,
Scott
I am getting this error when I actually try to send a local notification, even when the app has been given proper access:
Error sending notification: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 586 named com.apple.usernotifications.usernotificationservice"
Here is the notification sending code, though it is pretty straight forward:
UNMutableNotificationContent * userNote = [UNMutableNotificationContent new];
NSMutableArray * identifiers = [NSMutableArray new];
if (messages.count == 1) {
userNote.title = messages[0].sender[0].displayName;
userNote.subtitle = messages[0].subject;
}
else {
NSString * mkApplicationName = NSBundle.mainBundle.infoDictionary[@"CFBundleName"];
userNote.title = MKStringWithLocalizedFormat(@"@APP_RECEIVED_@NUM_MESSAGES", mkApplicationName, messages.count);
}
for (MKMessage* message in messages) {
if (message.postmarkIdentifier) {
[identifiers addObject:message.postmarkIdentifier];
}
}
userNote.body = self.notificationMessage;
userNote.userInfo = @{@"MessageIdentifiers":identifiers};
// Deliver the notification in now
UNTimeIntervalNotificationTrigger * trigger = [UNTimeIntervalNotificationTrigger
triggerWithTimeInterval:0.1 repeats:NO];
UNNotificationRequest * request = [UNNotificationRequest requestWithIdentifier:@"RuleNotification"
content:userNote trigger:trigger];
// Schedule the notification.
UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter];
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(@"Error sending notification: %@", error);
}
}];
Any ideas would be helpful, thanks,
Scott