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
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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
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