I am using Notification Serivce Extension to change the text coming from the server as per what I Want.
However, that was working good with normal strings. but when I used NSLocalizedString with it, it dosent show the localized string, instead it shows the field name of the string.
For example: inside the UNNotificationServiceExtension:
let CompanyViewLM = NSLocalizedString("Notifications.View", comment: "No Comment")
and in Localizable.strings I put the following line:
Notifications.View = "I Viewed your profile";
Noting that I put the same lines of code in a normal view controller and it works just fine.
I Found by my self what was the problem. The notification service target was working in the project without recognizing other files of the project.
To make it recognizes other files you must go to targets -> NotificationService -> Copy Bundle Resources -> add the files you want the notification service to work with.
In my case, I added the Localizable.strings file and it worked as a charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With