Skip to content

RN0.80.1, ios, Linking.addEventListener and Linking.getInitialURL does not work #53012

Description

@cx5168

Description

AppDelegate.swift:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { return RCTLinkingManager.application(app, open: url, options: options) }
Can get the URL of deeplink

info.plist:

<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLName</key> <string>com.testLinking</string> <key>CFBundleURLSchemes</key> <array> <string>app-test-linking</string> </array> </dict> </array>

app.js:
Linking.addEventListener('url', ({url}) => {})

Linking.getInitialURL().then((url) => {})

With the correct configuration, the linking API cannot be triggered.
how should i fix it.

Steps to reproduce

1, build
2, npm run ios
3, click deeplink [app-test-linking://...]

React Native Version

0.80.1

Affected Platforms

Build - MacOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 14.6
  CPU: (8) arm64 Apple M3
  Memory: 329.39 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.0.0
    wanted: 19.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.1
    wanted: 0.80.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

none

MANDATORY Reproducer

none

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: LinkingNeeds: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.Platform: iOSiOS applications.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions