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

When running the iOS app on an M1 mac, `getInitialURL` does not work

Open nmalzieu opened this issue 2 years ago • 5 comments

Description

When running the iOS version on an M1 Mac (using Mac (designed for iPad) option in XCode)

Deep links do not work when the app is killed i.e. getInitialURL() always returns empty string even if the app was opened using a deep link.

(If the app is already opened, the addEventListener url is called as usual)

React Native Version

0.72.5

Output of npx react-native info

System: OS: macOS 14.0 CPU: (10) arm64 Apple M1 Pro Memory: 433.00 MB / 16.00 GB Shell: version: 3.6.1 path: /opt/homebrew/bin/fish Binaries: Node: version: 18.18.0 path: /opt/homebrew/bin/node Yarn: version: 1.22.17 path: /opt/homebrew/bin/yarn npm: version: 9.9.1 path: ~/Documents/Projets/converse/app/node_modules/.bin/npm Watchman: Not Found Managers: CocoaPods: version: 1.14.2 path: /Users/noemalzieu/.rbenv/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: API Levels: - "30" Build Tools: - 30.0.3 System Images: - android-30 | Google APIs Intel x86 Atom_64 - android-32 | Google APIs ARM 64 v8a - android-32 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: version: 15.0.1/15A507 path: /usr/bin/xcodebuild Languages: Java: version: 11.0.20 path: /opt/homebrew/opt/openjdk@11/bin/javac Ruby: version: 2.7.6 path: /Users/noemalzieu/.rbenv/shims/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: ^18.2.0 react-native: installed: 0.72.5 wanted: ^0.72.5 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Steps to reproduce

Create a RN application and build it for M1 Mac in Xcode using the "Mac (Designed for iPad)" option.

Open the app via a custom scheme link while it's killed.

The getInitialURL method returns an empty string while it should contain the link used to open the app.

Snack, screenshot, or link to a repository

Here is the example repo : https://github.com/nmalzieu/deeplinkmacos

I added the following custom scheme : noedeeplinkmacos If I build for iOS & kill the app then click on the following link : noedeeplinkmacos://test-deeplink - it opens the app with the following screen:

Capture d’écran 2023-11-13 à 13 48 29

I then build for Mac (Designed for iPad) : NB I modified the scheme to "Wait for the executable to be launched". I then click on the same deeplink and here is what I get:

Capture d’écran 2023-11-13 à 13 50 07

However you can see that following clicks do trigger a linking event :

Capture d’écran 2023-11-13 à 13 53 16

So it's only the initial URL that doesn't get filled on Mac.

nmalzieu avatar Nov 13 '23 12:11 nmalzieu

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.72.6. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

github-actions[bot] avatar Nov 13 '23 12:11 github-actions[bot]

I confirm the error also occurs on 0.72.6

nmalzieu avatar Nov 13 '23 12:11 nmalzieu

same problem

MatheusLima7 avatar Mar 14 '24 21:03 MatheusLima7

+1, same issue, open source codebase at https://github.com/daimo-eth/daimo downloadable here as additional repro.

nalinbhardwaj avatar Mar 18 '24 18:03 nalinbhardwaj

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

react-native-bot avatar Sep 15 '24 05:09 react-native-bot

This issue was closed because it has been stalled for 7 days with no activity.

react-native-bot avatar Sep 22 '24 05:09 react-native-bot

Hoping that this issue is looked into.. Now that Mac apps are becoming more and more popular

fahad86 avatar May 27 '25 09:05 fahad86

@mdvacca @sammy-SC @rubennorte can this issue be re-opened? What do you guys think?

fahad86 avatar Sep 17 '25 10:09 fahad86