-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Action Buttons not appearing on iOS until notification made explicitly rich by adding picture #430
Comments
@XenorPLxx Can you share how you set up your Notification Service Extension? Also, in iOS, buttons will not show up at all unless you force-press on the notification. This is not a bug. It is iOS system behavior. You need to force-press/pull down to see the buttons. Just want to make sure that's not the issue. |
Hiya. Thanks for the response. I'm aware that I have to use 3D touch to make buttons appear on iOS, that is not the case. Buttons do not appear until I send at least one notification with picture included. For setup I've followed https://documentation.onesignal.com/v5.0/docs/react-native-sdk-setup, including adding Notification Service Extension with Objective-C code. For sending notifications I've tried both OneSignal dashboard (although buttons are part of Android notification there) and API by following documentation, which states that buttons work for both Android and iOS. I can upload screens of the steps mentioned in setup documentation tomorrow when I'll have access to my workstation if needed. I know that my colleague was able to reproduce the issue on some other project, I'm not sure if solution with sending picture worked for him though. I'll check with him tomorrow. |
Can you send your Can you also post a screenshot of the Xcode Project Settings for your OneSignalNotificationServiceExtension target, especially the |
Can you reproduce this behavior in our example project location in If so, can you please zip up the project and email a dropbox/etc. link to [email protected] so I can try to reproduce this issue? You don't have to send us your full app - just the demo app after you install dependencies and reproduce the issue. It would also be helpful for you to give me a Notification ID for one of the notifications that exhibited the problem - even if it's an exact duplicate of a notification that works later on. It's a bizarre issue - we've never heard of anything like this being reported before - so I'd definitely like to see exactly how you've got things configured. |
Sure, I'll prepare reproduction app over the weekend and I'll get back to you. |
Hello! I'm happy to inform that I have the repro ready and issue still appears (well, maybe not 'happy' happy, but you know what I mean :D). After downloading example app I:
Ziped repro app: https://synology.dawidkarczewski.pl/sharing/AerCCMgV8 (URL will expire at 31.12.2018) |
Hey @XenorPLxx thanks for all the details! I looked into the issue and it looks like your project has the Deployment Target for the OneSignalNotificationServiceExtension set to 12.1. You will definitely want to change this to 10.0 and that fixes the issue. I will need to do some further investigation to figure out why building the extension for 12.0+ appears to crash the extension before it can attach buttons/etc. But it works perfectly well with 10.0. |
Hiya! Thanks for the response. |
Hi @XenorPLxx I was able to reproduce the issue...until I lowered the deployment target. Now I cannot reproduce, even uninstalling + reinstalling the example app you sent. I am thinking this may be an issue in the Xcode + iOS betas as these distributions often have bugs. Can you try downgrading to the public releases of Xcode 10 & iOS 12.0 and lower the deployment target of the extension service and tell me if the issue still occurs? |
Also, here is an easier way to debug this. Instead of attaching buttons, try replacing the contents of your #import <RCTOneSignalExtensionService.h>
#import "NotificationService.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNNotificationRequest *receivedRequest;
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.receivedRequest = request;
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
self.bestAttemptContent.body = [@"[Modified] " stringByAppendingString:self.bestAttemptContent.body];
self.contentHandler(self.bestAttemptContent);
}
- (void)serviceExtensionTimeWillExpire {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
[RCTOneSignalExtensionService serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];
self.contentHandler(self.bestAttemptContent);
}
@end
Now, when you do that, whenever you receive a rich push notification (with buttons/photos/etc.) the body of the push notification will have |
@XenorPLxx Keep in mind that code I posted for I am pretty certain this is a bug in Xcode 10 beta or iOS 12.1 beta. I will attempt to reproduce. |
The only test I could do without access to additional iOS devices was to copy over support files for iOS 12.1 to public release XCode 10 and build from there, but it didn't do any change. I've also tried uncommenting 2 lines in original |
Yeah, even with iOS 12 beta + Xcode 10 beta, I cannot reproduce your issue. Just to make absolutely sure you are setting the deployment target correctly for the extension target and not the app target can you zip up the demo project as you currently have it and send it to me? |
Changing target for app is blocked in my Xcode for some reason, I can change only for extension target. Here's the current app zipped: https://synology.dawidkarczewski.pl/sharing/yHH9UbSQd (URL will expire at 31.12.2018) |
I've had another idea. Try this. Try replacing the contents of your Then, send a notification with buttons. We want to know two things: (A) Do the buttons appear? And (B) Does the title of the notification show up as [Modified 1] or [Modified 2], or neither? #import <RCTOneSignalExtensionService.h>
#import "NotificationService.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNNotificationRequest *receivedRequest;
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.receivedRequest = request;
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
self.bestAttemptContent.body = [@"[Modified 1] " stringByAppendingString:self.bestAttemptContent.body];
[RCTOneSignalExtensionService didReceiveNotificationRequest:self.receivedRequest withContent:self.bestAttemptContent];
self.bestAttemptContent.body = [@"[Modified 2] " stringByAppendingString:self.bestAttemptContent.body];
self.contentHandler(self.bestAttemptContent);
}
- (void)serviceExtensionTimeWillExpire {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
[RCTOneSignalExtensionService serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];
self.contentHandler(self.bestAttemptContent);
}
@end |
I've just remembered that earlier today I've changed extension target in the original app that has the same problem and just now I've tested dev release version - it also doesn't show buttons. Thanks to that I think we can exclude Xcode beta problems - to build mentioned version we use Bitrise and their 'previous stable' Xcode 9.4.1 stack. I'll test that build with some stable iOS 12 or earlier first thing tomorrow. |
I have done some more testing and I have been able to reliably reproduce this issue in iOS 12, both the public release and the beta. I've done some debugging and I've also been able to verify that our SDK is doing exactly what it should be doing. It's correctly registering a This is everything the system needs to add the button to the notification, but it still doesn't get added. I will be reporting this as a bug with iOS, and will be adding the radar issue # here. |
In fact this isn't just occurring with React-Native, it's occurring with our normal iOS SDK release as well. Thanks for reporting this and good catch! |
Always glad to help ^^ |
Have experienced this issue as well with a react-native build; Finding this report was helpful as i've been able to resolve it with adding an attachment. |
I have done further debugging - this is definitely an iOS 12 bug. I've opened a bug report with Apple, here is a radar to track it: |
@Nightsd01 hi, any further update or workaround could resolve this issue? thanks. |
@neo125874 apparently this issue has been reported before I created my bug report, Apple told me they’re aware of the issue and are working on it. I don’t have an ETA at the moment. It is quite an aggravating bug. I was able to reproduce even without our SDK. I will update this issue when I hear anything further. The only workaround I know of is a really annoying one: use the |
https://webappcodes.com/tag/notification Here is a link for integrate push notification in ios |
Any info if this bug has been solved or if it still affects newer releases of iOS 12? |
I haven't heard any recent complaints about this issue. I think it is safe to close. I will leave it open for another week to see if anyone reports anything @mcontin |
@GaborWnuk you might want to recheck if issue is still valid ⬆️ |
Closing due to no response |
Anyone still experiencing this except me? I updated everything to the newest versions (Xcode 11, iOS 13.1.2), have reimplemented OneSignal with Groups and ServiceExtension (target 10.0) several times, even recreated my app from scratch, double/triple/milliontimes checked every step in the documentation, I just don't get the action buttons to work on iOS. Action buttons work perfectly on Android, they even work on iOS if I attach a picture, but as soon as I remove the picture again, the buttons are gone as well.. |
* Re-listing notifications categories after registering to force a refresh of them. - See comment for more details. * These are the dynamic per notification buttons set via the dashboard or REST API * Issue started to show up in iOS 12 * Fixes #430
* Re-listing notifications categories after registering to force a refresh of them. - See comment for more details. * These are the dynamic per notification buttons set via the dashboard or REST API * Issue started to show up in iOS 12 * Fixes #430
Is there any updates for this issue? Is it fixed? |
If anyone finds this, i still have this issue in another product in 2022, iOS 16. I firstly solved this by adding a sleep(1) function after i added my category, then listing categories again. Which makes me think there is some disk or synchronisation step in the background happening in the OS. See below for my better solution, no sleep needed! func setCategories(newCategory: UNNotificationCategory) async -> Bool {
return await withCheckedContinuation {continuation in
UNUserNotificationCenter.current().getNotificationCategories { categories in
var allCategories: Set<UNNotificationCategory> = categories
allCategories.insert(newCategory)
UNUserNotificationCenter.current().setNotificationCategories(allCategories)
UNUserNotificationCenter.current().getNotificationCategories { categories in
continuation.resume(returning: true)
}
}
}
} |
Description:
Hello!
I've setup OneSignal push notifications in my React Native app that is build for both Android and iOS.
I'm trying to send basic notification from OneSignal dashboard that includes buttons. While my app is in foreground, everything looks fine - I see buttons in payload, so I display them in in-app notification.
When application is in background or closed, buttons are handled as a part of system notification. On Android it works fine, but on iOS I don't see the buttons (even tho they are in payload in my
opened
eventListener
.I rechecked if native setup done correctly on iOS and I've started to play with different settings in the OneSignal dashboard. After I've added picture to iOS notification (with buttons setup), I've got BOTH picture and buttons. And after that, even without picture, I've started getting buttons correctly on iOS.
It all worked until I've tried removing app from my phone. After reinstallation buttons disappeared and again, sending picture once made them available in later notifications.
React Native library is just a SDK wrapper for handling notifications, hence I think this is the best place to put that issue in.
Environment
react-native 3.2.7 includes iOS SDK 2.8.8 (per https://github.com/geektimecoil/react-native-onesignal/releases)
Linking
12.0, 12.1
Steps to Reproduce Issue:
The text was updated successfully, but these errors were encountered: