Closed suhabaobaid closed 1 year ago
Hey @suhabaobaid , thanks for the reproduction steps! We'll take a closer look and keep you updated.
For more details, do you notice if this is reproducible at any point when tapping a push notification, or does this only happen under certain app states (i.e. app is not in memory, app is open but in background)?
Additionally, to double check, do you happen to have any custom implementations of braze.delegate
other than the default, particularly with the shouldOpenURL
method?
Could you also verify how the URL scheme is registered in your Info.plist?
hey @jerielng Thanks for checking on it!
For more details, do you notice if this is reproducible at any point when tapping a push notification, or does this only happen under certain app states (i.e. app is not in memory, app is open but in background)?
It doesn't work when tapping the notification both if app is in background and if not in memory
Additionally, to double check, do you happen to have any custom implementations of braze.delegate other than the default, particularly with the shouldOpenURL method?
No custom implementations for the braze.delegate
Could you also verify how the URL scheme is registered in your Info.plist?
Yeah, it is the same as the documentation as well as the same scheme that was used when we were using the Appboy
sdk and it was working fine
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>YOUR.SCHEME</string>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR.SCHEME</string>
</array>
</dict>
</array>
If it is any help as well, calling UIApplication.shared.canOpenURL
in the app with the URL sent through the Push notification returns true. So it is not a scheme issue?
If it is any help as well, calling
UIApplication.shared.canOpenURL
in the app with the URL sent through the Push notification returns true. So it is not a scheme issue?
Thanks! That's good info to know. For a sanity check, one thing you can also try is implementing the braze.delegate
and shouldOpenURL
method and then checking if that delegate method is being called in your case. You should be able to verify whether it's being triggered in 1) your in-app deeplink case, which works as expected and 2) the push notification deeplink case
So for instance, using a sample class as the BrazeDelegate:
class TestDelegate: BrazeDelegate {
func braze(_ braze: Braze, shouldOpenURL context: Braze.URLContext) -> Bool {
return true // Set a breakpoint here
}
}
and then on your braze
instance, assigning the delegate at app launch:
braze.delegate = TestDelegate()
Additionally, if there are any logs you can also provide, those would be helpful as well!
Just tested that out, for 1) in-app: shouldOpenURL
is triggered, 2) push: shouldOpenURL
is not triggered.
Is there any specific logs that would help? Other than the ones provided
It's also possible that the notification processing may not be fully handled.
You noted that braze.notifications.handleBackgroundNotification
is being called when didReceiveRemoteNotification
is triggered. Upon tapping the push notification, userNotificationCenter(_:didReceive:withCompletionHandler:)
should also execute, which is where you should be handling the URL from the payload.
Referring to this section here, could you verify that braze.notifications.handleUserNotification
is also being triggered from this UNUserNotificationCenterDelegate
method?
We have some examples in our public repo to show what this may look like.
ah yes! implementing userNotificationCenter(_:didReceive:withCompletionHandler:)
did the trick. It is now working as expected.
Although in the migration doc, it wasn't clear that this was a needed step to handle processing the standard notification properly and more so if we need to handle the custom actions of the push notification
Thanks for the assist!
Platform
iOS
Platform Version
IOS 16.0.3
Braze SDK Version
6.1.0
Xcode Version
Xcode 14.2
Computer Processor
Apple (M1)
Repro Rate
100%
Steps To Reproduce
Example:
Deep Link into application
option and provide linkdidReceiveRemoteNotification
is called, then callbraze.notifications.handleBackgroundNotification(userInfo: userInfo, fetchCompletionHandler: completionHandler)
application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:])
to be called due the url but it is not called so the deeplink url is not processed as expectedExpected Behavior
openURL
gets called with the URL specified in the push.Note: We just migrated to the Braze sdk 6.1.0 and prior to that was using Appboy sdk and it was working as expected.
Actual Incorrect Behavior
no deeplink is being processed, push only opens the app
Verbose Logs
No response
Additional Information
In-app deeplinking works as expected as well as email deeplinks