question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS: Linking.openURL(href) cannot open universal link in app (safari instead)

See original GitHub issue

My app has already set up deeplink and universal linking for iOS, applinks for android. It works perfectly for months until I found a use case that Linking.openURL(href) fails on iOS.

              // If I click this url in external browser, my native app will be launch because I've already handled universal link
              const href = "https://my-universal-link-supported-domain.com/foo/bar";
              Linking.canOpenURL(href).then(supported => {
                if (supported) {
                  Linking.openURL(href);
                }
              });

Steps To Reproduce

  1. Setup deeplink, universal link for ios, app-links for android
  2. Execute: Linking.openURL(href)
  3. Fail to open href by native app on iOS, still work on Android

Describe what you expected to happen: iOS only: URL was opened by Safari on iOS . URL was opened by the app normally on Android

Expected URL was opened in the app on iOS

React Native version:

System:
    OS: macOS 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 52.93 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.11.0 - ~/.nvm/versions/node/v10.11.0/bin/node
    Yarn: 1.12.3 - ~/.nvm/versions/node/v10.11.0/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.11.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 26, 28, 29
      Build Tools: 28.0.3
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 10.2/10E125 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: ^0.60.3 => 0.60.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native: 0.59.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
brandonpearcycommented, Dec 12, 2019

I’ll open a new one now and link back to this one!

2reactions
darrenyaoyaocommented, Dec 5, 2019

Hi @luatnd did you manage to solve the problem? Still having the issue in 0.61.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS: Linking.openURL(href) cannot open universal link in app ...
If an app is registered to handle a specific URL, it will always open in that app, regardless of how that link was...
Read more >
iOS Universal Links are not opening in-app - Stack Overflow
Long press on Universal link in Mail or iMessage, then you will see options whether to open in safari or in App.
Read more >
Universal Links not opening in app… | Apple Developer Forums
I believe I have everything configured correctly for Universal Links to be working, but every method I try to launch a link just...
Read more >
Universal links in iOS. Last day I was asked to integrate deep…
Instead of opening up Safari first when a link is clicked, iOS will check if a Universal Link has been registered (an AASA...
Read more >
Linking - Expo Documentation
You can also open a URL by searching for it on the device's native browser. For example, opening Safari on iOS and typing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found