React-native-onesignal: [modified] on headings ?

Created on 15 Oct 2018  ·  6Comments  ·  Source: OneSignal/react-native-onesignal

I push nofitication with structure:

{
    "app_id": "appid",
    "contents": { "en": "Test message one signal" },
    "filters": [
        {"field": "tag", "key": "userId", "relation": "=", "value": 1}
    ],
    "headings": {"en":"test headings"},
    "ios_badgeType": "Increase",
    "ios_badgeCount": 1,
}

But the headings contain a tag [modified], it show on ios 12, but does not show on ios 9 ? How to fix it ?
44077169_533593840401849_1463818175526207488_n

Most helpful comment

I have the same problem. I solve this problem this way.
Open your project on XCode. Then, right click YourNotificaitonServiceExtension > Build Phases > Compile Source > NotificationService.m, then click Open as > Source Code. On the 'self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",' line, remove [modified] string. Then problem solved for me.

All 6 comments

@dungnguyen10989 Please check your NotificationService.m and make sure you replaced it with the contents from our docs.

And please note that the notification service extension only works in iOS 10 and later.

I have the same problem, but using another platform. How could you solve it?

I have the same problem. I solve this problem this way.
Open your project on XCode. Then, right click YourNotificaitonServiceExtension > Build Phases > Compile Source > NotificationService.m, then click Open as > Source Code. On the 'self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",' line, remove [modified] string. Then problem solved for me.

Having [modified] in notification title is not a bug or issue to fix.
It is for debugging purposes to confirm that Notification Service Extension is running properly (because service extension is a separate project than the App), so having [modified] in notification title is a sign that your Service Extension works.

More info here:
https://documentation.onesignal.com/docs/troubleshooting-ios#section-debug-the-notification-service-extension

better approach is to make it conditional :

    #ifdef DEBUG
      self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",    self.bestAttemptContent.title];
    #endif

Or you can remove it completely if not using service extension.

@Nightsd01 I have the same problem. Unfortunately I can't remove the [modified] string from my NotificationService.m because that string isn't present at all in the Swift code. it's only present in Objective C code (which i don't use. i use swift). But the [modified] string still appears in my headings.

Remove the line with "[modified]" from NotificationService.swift or NotificationService.m file

Was this page helpful?
0 / 5 - 0 ratings