我使用uri-方案进行环境设置和测试,并按照反应导航医生中的步骤设置导航。当我用npx uri-scheme open myapp://do_something/some_params --{android/ios}在模拟器上测试时,一切看起来都很好。当应用程序运行前景、背景或关闭时,它就能工作。然而,当我试用我的手机时,什么都没有发生。
我试着点击电子邮件中的链接,什么都不会发生。在浏览器地址栏中,我尝试输入uri myapp://do_something/some_params。浏览器仍然在主页上,没有“打开的myapp”弹出。
AndroidManifest.xml:
...
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="myapp"/>
</intent-filter>
</activity>
...Info.plist:
...
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>
...附件代表:
#import <React/RCTLinkingManager.h>
...
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
...App.js:
const deepLinkingConfig = {
prefixes: ['myapp://'],
config: {
screens: {
HOME: {
screens: {
SOMESCREEN: 'do_something/:some_params',
}
}
},
},
}
...
<NavigationContainer linking={deepLinkingConfig}>
...
<NavigationContainer />
...我没发现出什么问题。
发布于 2021-12-10 23:43:17
在为应用程序提供真正的http模式之前,它是不可点击的。
您必须配置通用链接,请参见此处:响应本机url深链接(如YouTube )
iOS:https://www.raywenderlich.com/6080-universal-links-make-the-connection
安卓:https://developer.android.com/training/app-links
还请看一下Firebase动态链接:BwE&gclsrc=aw.ds
发布于 2021-12-10 23:34:49
您应该创建一个包含链接的小示例HTML页面,并在浏览器中打开此页面。如果将链接输入浏览器,只需单击链接即可调用深度链接。另外,并不是所有的应用程序(比如你的邮件客户端)都支持深度链接。此外,您应该首先从配置开始您的应用程序,然后给系统一点时间(最多一分钟)来注册更改。如果没有工作,尝试卸载和重新安装。不幸的是,脱墨有一些缺点。
https://stackoverflow.com/questions/70311314
复制相似问题