0

When handling a deeplink when the app is closed, we are having to temporarily store the userInfo from didReceiveRemoteNotification and wait until the SDK is fully initialized before calling setNotificationUserInfo().

This is working correctly when using normal Push Notifications, but when we add a deeplink (_od) it's causing the app to crash when that sdk function is called

6
  • Do you have an open support case?
    – Bill Mote
    Mar 23, 2022 at 16:40
  • Not at the moment, I'm just the developer on the project. I don't have access to create a support ticket
    – Chad
    Mar 23, 2022 at 16:43
  • Please get support involved. Any support offered here is voluntary. When opening a support case please provide the output from the SDK's get state method as well as logs from initialization continuing through the problem you're experiencing as that will speed the process along.
    – Bill Mote
    Mar 23, 2022 at 16:45
  • Correction: we opened a support ticket for a similar issue (Case#42145522) but didn't get a clear answer. I'm unable to get logs because this is dealing with a closed app, so Xcode shuts down the console when you close the app. But, we did wrap the call within getStatus() if SFMCSdk.mp.getStatus() == .operational { SFMCSdk.mp.setNotificationUserInfo(info) }
    – Chad
    Mar 23, 2022 at 16:50
  • I will see if I can find your ticket. Just in case, have them at-mention me on the ticket, please. The number you get doesn't always align with what I can see.
    – Bill Mote
    Mar 24, 2022 at 11:54

1 Answer 1

1

When the application is in "Not Running" state, app would loose its previous state and would start afresh which means, app would re-start with didFinishLaunch method getting called. At this point, the entire state of the app's dependants would also have to be re-initialized.

Same happens with the SDK as well, the notification userinfo is not known to the SDK as it would have not been initialized and the URL handling delegate would have not been set when the app is launched afresh. Hence, the application should pass on the notification object to the SDK only when ready.

This will work for a normal push as it just launches the application and no actions to be done with the payload by the SDK.

Also, please note that the register for remote notification should be called in the success callback of SDK init as SDK depends on the notification userinfo, otherwise may lead to the above crash.

Thanks, Prakashini

2
  • We were able to get around the crash issue by stripping the "_od" value from userInfo before sending it to the sdk. This allows us to still get Salesforce "opened" Analytics from Push Notifications that include deeplink url's Like you mentioned, since the sdk has't been initiated yet since the app is opening from a "not running" state, we can't use the handleUrl() function and need to handle url routing (deep linking) on our own
    – Chad
    Mar 25, 2022 at 15:14
  • "_od" value need not be stripped, instead userinfo object can be set to the SDK method after successful initialization of the SDK, post the delegate method is set. This will trigger the handleURL protocol without having to handle url routing on your won. Mar 28, 2022 at 5:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .