我正在使用 ionic deeplink 插件ionic-plugin-deeplinks它适用于 android,但由于它不适用于 ios,我被迫安装另一个插件cordova-deeplink和cordova-universal0links-plugin。包.json:
"@ionic-native/deeplinks": "^4.16.0",
“cordova-deeplink”:“git+ https://github.com/foneclay/cordova-universal-links-plugin.git#2.3.1”,“cordova-universal-links-plugin”:“1.2.1 ”等我的组件.ts:
platform.ready().then(() => {
if (this.platform.is('android')) {
this.deeplinks.routeWithNavController(this.nav, {
'/e-training/course_overview/:courseID': CourseDetailsPage,
.......
}).subscribe((match) => {
console.log('Successfully routed', match);
}, (nomatch) => {
console.log('Unmatched Route', nomatch);
});
} else {
if (this.platform.is('ios')) {
universalLinks.subscribe('openApp', this.onAppRequest.bind(this));
universalLinks.subscribe('openPage', this.onPageRequest.bind(this));
}
}
});
配置.xml:
<universal-links>
<host event="openApp" name="example.com" scheme="https">
<path event="openPage" url="/" />
</host>
</universal-links>
在 android 上一切正常,但在 ios 中,只有当应用程序仍在后台时才有效,当我杀死应用程序(终止它)并单击我通过应用程序共享的任何链接时,它打开应用程序的主页,没有去深入细节。
离子:
- 离子(离子 CLI):4.0.2
- 离子框架:离子角
- 3.9.2 @ionic/app-scripts:3.2.0
科尔多瓦:
- 科尔多瓦(科尔多瓦 CLI):8.1.2(科尔多瓦-lib@8.1.1)
- Cordova 平台:不可用
系统:
- Android SDK 工具:25.2.5
- 节点JS:v8.9.3
- npm:5.4.2
- 操作系统:Windows 10