我有一个离子按钮,它通过谷歌认证和Firebase注册用户。
<ion-buttons end>
<a href="#" (click)="GoogleAuth()" target="_blank">
<img src="../../assets/signInButton.png">
</a>
</ion-buttons>
该函数是:
async GoogleAuth() {
try {
const provider = new GoogleAuthProvider();
await this.afAuth.signInWithRedirect(provider);
} catch (error) {
console.log(error);
}
在网络上一切正常。
当我为iOS构建应用程序时,它无法打开。
因此,我安装了软件包“”。安装时,错误消息是在第一:<universal-links> tag is not set in the config.xml. Universal Links plugin is not going to work.
所以我在xcode项目中编辑了我的配置文件:
<widget id="de.markb.drinktogether" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>DrinkTogether</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<universal-links>
<host name="https://drink-together-3d735.firebaseapp.com">
<path url="/__/auth/handler/*" />
</host>
</universal-links>
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
经过编辑和buidling应用程序再次我得到这个错误:
IOS project Code Sign Entitlements now set to: DrinkTogether/Resources/DrinkTogether.entitlements
Entitlements file is not in references section, adding it
Error: ENOENT: no such file or directory, open '/Users/markbaumann/Desktop/drink-together/ul_web_hooks/ios/https:/drink-together-3d735.firebaseapp.com#apple-app-site-association'
at Object.openSync (node:fs:600:3)
at Object.writeFileSync (node:fs:2221:35)
at saveContentToFile (/Users/markbaumann/Desktop/drink-together/plugins/cordova-universal-links-plugin/hooks/lib/ios/appleAppSiteAssociationFile.js:118:8)
at /Users/markbaumann/Desktop/drink-together/plugins/cordova-universal-links-plugin/hooks/lib/ios/appleAppSiteAssociationFile.js:72:5
at Array.forEach (<anonymous>)
at createNewAssociationFiles (/Users/markbaumann/Desktop/drink-together/plugins/cordova-universal-links-plugin/hooks/lib/ios/appleAppSiteAssociationFile.js:70:27)
at Object.generate (/Users/markbaumann/Desktop/drink-together/plugins/cordova-universal-links-plugin/hooks/lib/ios/appleAppSiteAssociationFile.js:45:3)
at activateUniversalLinksInIos (/Users/markbaumann/Desktop/drink-together/plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js:85:29)
at /Users/markbaumann/Desktop/drink-together/plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js:50:11
at Array.forEach (<anonymous>) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/Users/markbaumann/Desktop/drink-together/ul_web_hooks/ios/https:/drink-together-3d735.firebaseapp.com#apple-app-site-association'
}
如何在IOS中打开外部链接,以便我的用户可以通过Google在我的应用程序中注册?
我以为它会打开默认浏览器
1条答案
按热度按时间muk1a3rh1#
尝试使用电容器浏览器插件:
你的按钮会调用一个调用插件的方法。所以在你的模板部分:
在脚本部分:
请注意,一旦浏览器启动,您就无法控制用户的操作,因此您应该侦听
browserFinished
事件,然后检查用户是否已经登录。