react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

[iOS] Notification does not deeplink when app is in closed state

Open stu-dev opened this issue 6 years ago • 18 comments

Description:

Apologies in advance for not following proper issue-reporting procedures. I had previously commented on another issue but I'm guessing contributors aren't notified on closed issues.

Below is a matrix to help describe my issue:

                                     Android | iOS
              Deep link (app in bg):    ✅   |  ✅
             Deep link (app closed):    ✅   |  ✅
 Notification Deep link (app in bg):    ✅   |  ✅
Notification Deep link (app closed):    ✅   |  ❌

Linking.getInitialURL() returns undefined only when deep linking on iOS from a onesignal push alert in an app-closed state. (Returns a value for all other scenarios)

I'm no iOS developer so I wouldn't know where to start but is there not some native code that could solve this? Adding a listener in the JS seems like an unnecessary/hacky solution when it's only needed to solve 1 in 4 onesignal deep link scenarios.

Environment

"react-native": "0.62.2",
"react-native-onesignal": "3.8.1"

stu-dev avatar Jul 07 '20 22:07 stu-dev

Howdy, Thanks for your patience.

Take a look at this thread for a workaround on this issue. Hopefully RN resolves this soon.

Cheers

rgomezp avatar Jul 22 '20 23:07 rgomezp

I'm not sure where the problem is, but when I try to open my app via xcrun it works properly. In other way when I try it from a Push Notification it doesn't.

xcrun simctl openurl booted "app://deeplink.url"

@stu-dev Did you find out how to fix it?

ghost avatar Oct 26 '20 20:10 ghost

Howdy, I will close this issue in this repository since it is not a OneSignal-related problem. Please continue tracking the issue in the above linked thread.

Thank you

rgomezp avatar Oct 27 '20 00:10 rgomezp

I'm not a 100% sure about that @rgomezp. Because when I use xcrun to run my closed app with a link, it works perfectly.

ghost avatar Oct 27 '20 11:10 ghost

Any news on this?

ghost avatar Dec 10 '20 13:12 ghost

Howdy @emilioheinz , If this is indeed a OneSignal problem, it may be fixed by a small change that we recently made to the way the notification open handler works. It will be included in the next major-release version of the SDK. If you could please test your issue with that version when it is released that would be great.

Take a look at our mobile SDK migration guides for more info.

Thank you for your patience and cooperation.

rgomezp avatar Dec 10 '20 18:12 rgomezp

Ok, I will do so. Have you any expectation about when the next major-release version of the SDK will be available?

ghost avatar Dec 10 '20 18:12 ghost

Hi all, Is there an update on this issue? Surely having deep linking working is quite a major part of OneSignal's offering?

tomwhale avatar Mar 04 '21 09:03 tomwhale

@tomwhale I'm not sure if it is an OneSignal or React Native bug. Do you have any idea?

ghost avatar Mar 04 '21 10:03 ghost

Yep it definitely is, prior to #1140 being "resolved" deep linking was working fine in all cases (but you had an alert that popped up asking you to "Open website" which is not ideal).

Then #1140 was fixed but this resulted in a regression of the deep linking (now no longer works from closed state). So now we are back to where we started.

Edit: if you read the SDK issue that this started in (https://github.com/OneSignal/OneSignal-iOS-SDK/issues/777) it seems clear that there has been a miscommunication between the issue from a RN perspective vs a native iOS perspective. The iOS devs wanted the "Open website" functionality removed (including auto deeplinking) so they could handle it manually themselves. Whereas the RN issue just wanted it to skip the "Open website" and auto-deeplink.

stu-dev avatar Mar 04 '21 10:03 stu-dev

Any update on this issue?

azai91 avatar Mar 20 '21 17:03 azai91

Any update, notification deeplink doesn't work

dzpt avatar Mar 23 '21 09:03 dzpt

Yup, this bug is preventing from us from going into production (as we use deeplinks in pushes to launch in-app chat and that confirmation dialog is bummer). Any updates at least on what causes it so that we can try to find a workaround/manually patch until an official fix is released?

canpoyrazoglu avatar Mar 26 '21 10:03 canpoyrazoglu

Same issue with flutter's sdk on deep linking

marclester-tang avatar Mar 27 '21 18:03 marclester-tang

Please update to version 4.0.6

Enjoy!

rgomezp avatar Mar 31 '21 21:03 rgomezp

Tried. I confirm that it's fixed on 4.0.6. Thank you!

canpoyrazoglu avatar Mar 31 '21 21:03 canpoyrazoglu

For visibility: related workaround for deep linking problems - https://documentation.onesignal.com/docs/react-native-sdk#setnotificationopenedhandler-function

rgomezp avatar May 24 '21 20:05 rgomezp

Im getting this same error using Expo SDK 51 with expo router.

oliviercperrier avatar Aug 31 '24 02:08 oliviercperrier