我有一个以前从未遇到过的有趣问题。在新的 iOs 项目上尝试使用FirebasePlugin.getVerificationID时会引发以下错误:
'Please register custom URL scheme 'com.googleusercontent.apps.xxxxx' in the app's Info.plist file.'
示例函数是:
if (!data.phoneNumber) {
return;
}
let phoneNumberString = "+44" + data.phoneNumber;
(<any>window).FirebasePlugin.getVerificationID(phoneNumberString, id => {
this.navCtrl.push('verify', { id: id });
}, error => {
console.error("SMS error", error);
})
我使用 Ionic Appflow 编译应用程序,因此不使用 XCode 来管理项目文件。为了解决上述错误,我将以下代码放在“GoogleService-Info.plist”中:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.xxx</string>
</array>
</dict>
</array>
但是,即使 plistfile 包含在应用程序的编译中,这仍然会返回错误。
我欢迎任何人可能有的任何想法。