Skip to content
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

[iOS] PushNotification with DeepLinks doesn't work when the app is close #48295

Open
Javs-21 opened this issue Dec 17, 2024 · 5 comments
Open
Labels
API: Linking Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: iOS iOS applications.

Comments

@Javs-21
Copy link

Javs-21 commented Dec 17, 2024

Description

when my iOS app receive push notification and when the app is close only opens in the home screen but never goes to the screen with the deeplink route, i always get url = null

//this way is to detect universal deep link
    Linking.getInitialURL()
      .then((url) => {
        console.log('DEEPLINK', url);
        if (url) {
          Linking.canOpenURL(url).then((supported) =>
            supported ? handleDeepLink(url) : null,
          );
        }
      })
      .catch((err) => {
        console.warn('An error occurred deepLink', err);
      });

but the curious thing is when the app is open or in the background it works perfectly, I have implemented documentation's setup with universal links

I am currently working with react native 0.73.11 and i updated to 0.74.6 and 0.75.1 because in your CHANGELOG mentions changes with Push Notification on iOS but the behavior is the same NO FIX

also looking on internet I haven't found any solution

Steps to reproduce

  1. close the iOS app
  2. send a push notification with deep links
  3. the app should open in the correct screen but only open at home screen

React Native Version

0.73.11

Affected Platforms

Runtime - iOS, Other (please specify)

Output of npx react-native info

System:
  OS: macOS 15.1.1
  CPU: (8) arm64 Apple M2
  Memory: 132.95 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.11.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK:
    API Levels:
      - "31"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-29 | Google Play ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-TiramisuPrivacySandbox | Google Play ARM 64 v8a
      - android-VanillaIceCream | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.1
    wanted: 0.75.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

not apply

Reproducer

none

Screenshots and Videos

none

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Dec 17, 2024
@react-native-bot
Copy link
Collaborator

Warning

Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@react-native-bot react-native-bot added Type: Unsupported Version Issues reported to a version of React Native that is no longer supported Platform: iOS iOS applications. and removed Needs: Triage 🔍 labels Dec 17, 2024
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@react-native-bot
Copy link
Collaborator

Warning

Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@sarthak-d11
Copy link
Contributor

@Javs-21
It would be great if you could provide a sample reproducer. You can use this template.

A few things to clarify:

  1. Is this issue specific to iOS only?
  2. Can you try this on the new architecture (NewArch)?
  3. What happens if you use the deeplink without a push notification (i.e., paste the deeplink in a messaging app and then open it)? Does it work or not?

@shubhamguptadream11 shubhamguptadream11 added API: Linking and removed Type: Unsupported Version Issues reported to a version of React Native that is no longer supported labels Dec 17, 2024
@Javs-21
Copy link
Author

Javs-21 commented Dec 17, 2024

@shubhamguptadream11 thanks for you replayed for security purposes i can't share or create information about the project (is for a big company).

  1. yes only happens on iOS, Android works perfectly.
  2. yes, test in the new arch.
  3. with simulator iphone 16 pro and this command xcrun simctl openurl booted myapp://SCREEN works also with urls, but when it receives a push notification with a deeplink never works.

you can find more cases like mine one
[Deep linking - doesn't work if app is closed](https://stackoverflow.com/questions/67789779/deep-linking-doesnt-work-if-app-is-closed)
Deep linking is not working when app is closed/killed
Universal links callback doesn't work if launching closed app
[iOS Universal Links are not opening in-app](https://stackoverflow.com/questions/32751225/ios-universal-links-are-not-opening-in-app/76254119)

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Linking Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: iOS iOS applications.
Projects
None yet
Development

No branches or pull requests

4 participants