-
Notifications
You must be signed in to change notification settings - Fork 264
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
OneSignal seems to swizzle app delegate methods and didReceiveRemoteNotification
is not called
#1045
Comments
@hyouuu Thanks for reporting, providing logging, and providing detailed behavior details. From the log it looks like the OneSignal SDK is trying to call your
In the OneSignal SDK source this comes from this line: There are some checks below this, so it is possible something is falling here. Does your method fire if you tap on the notification? On the We can attempt to reproduce the issue with a new Swift project but I suspect a basic project like this won't reproduce the issue. If possible if you could provide an example project reproducing the issue and / or provide more details about how your AppDelegate is setup that will help find the root issue faster. |
Thanks for the quick response @jkasten2 ! Sorry forgot to mention an important part, that my app is using the new SwiftUI app lifecycle and the app delegate is set up using So I guess the reason is because the What's the reason removing the |
So a sample app would look like this:
|
@jkasten2 Here are some insights on the SwiftUI appDelegate's relationship with |
Also cc @JKalash & @Nightsd01 listed as authors in the XCFramework pod file. Thanks in advance! |
@hyouuu Thanks for sharing the code! I don't believe we have tested |
That would be awesome thank you! |
Same problem here, updated from v2 in IOS to the last version 3.. and now didReceiveRemoteNotification:fetchCompletionHandler is not getting called at all, nor when app is in background either foreground.. Any clue ? |
@bierzorutas besides this problem I also got the app freezing when receiving any notifications in v3, so what I ended up doing was to clone the repo, switch to the release-2.x.x branch and build XCFramework locally. You probably want to try the same as I don't see advantages of v3 but only unnecessary changes and bugs so far :( |
@hyouuu Could you provide more details on the freezing you are seeing? We would like to investigate and address this as well. Could you create another issue with those details so we can look into it? |
Sorry don't have time right now to switch back to 3.x and reproduce the issues. But I believe I saw the verbose log saying the foreground notification will show and calling legacy selectors and then the app would freeze. Might be the SwiftUI app delegator causing an infinite loop or something. It never happens with 2.x tho |
@jkasten2 Is there any update on when we might have a solution for this in the SDK? This same issue is affecting us as well and prevents us from acting on silent push notifications in our use-case. Thanks 👍 |
+1 this is a blocker for our app. |
I reproduced this issue in a SwiftUI app and am looking into the PR provided I apologize for the delay |
@chris @zac @hyouuu @bierzorutas A fix for this was released in OneSignal 3.11.2. |
Description:
Just updated OneSignal from 2.x to the latest 3.10.0 with SPM. In 2.x there was a
OSHandleNotificationReceivedBlock
that we can set to deal with received remote notification, but 3.x removed it and from the doc we should handle it in appDelegate'sHowever, it is never called nor
didRegisterForRemoteNotificationsWithDeviceToken
ordidFailToRegisterForRemoteNotificationsWithError
. I turned OneSignal Verbose logging on, and when a silent notification is sent I got these stacktrace:VERBOSE: onesignalUserNotificationCenter:willPresentNotification:withCompletionHandler: Fired! some message
VERBOSE: finishProcessingNotification: Fired!
VERBOSE: Notification display type: 7
VERBOSE: notificationReceived called! opened: NO
VERBOSE: callLegacyAppDeletegateSelector:withCompletionHandler: Fired!
VERBOSE: finishProcessingNotification: call completionHandler with options: 7
VERBOSE: oneSignalReceiveRemoteNotification:UserInfo:fetchCompletionHandler:
VERBOSE: notificationReceived called! opened: NO
So apparently OneSignal got the remote notification received trigger, but masked the original appDelegate. If in
didFinishLaunchingWithOptions
I explicitly setapplication.delegate = self
other weird behaviors would happen.Could you restore
OSHandleNotificationReceivedBlock
and makeoneSignalReceiveRemoteNotification
call it? Should be pretty straightforward and it would keep the 2.x behavior.Environment
3.10.0 with SPM using the XCFramework version
Steps to Reproduce Issue:
The text was updated successfully, but these errors were encountered: