我正在使用离子深层链接插件 ionic-plugin-deeplinks ,它在android上运行良好,但由于在ios上不起作用,我不得不安装另一个插件 cordova-deeplink < / strong>和 cordova-universal0links-plugin 。 package.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” 所以在我的component.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));
}
}
});
config.xml:
<universal-links>
<host event="openApp" name="example.com" scheme="https">
<path event="openPage" url="/" />
</host>
</universal-links>
在android上一切正常,但在ios中,只有当应用仍在后台,我杀死该应用(终止)并单击通过该应用共享的任何链接时,它才能打开该应用的首页,不要深入细节。
离子:
科尔多瓦:
系统:
答案 0 :(得分:0)
我刚刚删除了 cordova-deeplink 和 cordova-universal-links-plugin 插件以及与之相关的所有内容:就像我在其中删除了标签<universal-links>....</universal-links>
config.xml
以及与ios部分相关的app.component.ts中的代码,并替换为:
//this.platform.is('android') || this.platform.is('ios')
this.deeplinks.routeWithNavController(this.nav, {
'/e-training/course_overview/:courseID': CourseDetailsPage,
...
}).subscribe((match) => {
console.log('Successfully routed', match);
}, (nomatch) => {
console.log('Unmatched Route', nomatch);
});