Tried to add a number inside a localized string with localizedUserNotificationString
function. However, passing the argument into the function would cause a server connection error despite its a local notification. Replacing the arguments with a nil
can solve the issue though.
// the real type of day is Int OR
let day = getDay()
// Same error with both Int and CVarArg type
let day = getDay() as CVarArg
content.title = NSString.localizedUserNotificationString(
forKey: "day %@",
arguments: [day]
)
Inside Localizable.strings,
"day %@" = "Day %@";
The error is
APP_NAME[60875:8076287] [Connections] [www.domain.APP_NAME] Adding notification request failed with error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service on pid 40685 named com.apple.usernotifications.usernotificationservice" UserInfo={NSDebugDescription=connection to service on pid 40685 named com.apple.usernotifications.usernotificationservice}
ERROR:setupNotification Couldn’t communicate with a helper application.