当我想使用带有firebase的sms auth时,应用程序仅在iOS上失败
APN证书已在firebase上配置,并且Info.plist
中的FirebaseAppDelegateProxyEnabled
为NO。执行verifyPhoneNumber方法期间发生错误。
这是flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.7.0, on Mac OS X 10.14.5 18F132, locale en-PE)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.36.1)
[✓] Connected device (1 available)
下面是我的代码
void sendSms(String fullNumber) {
FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: fullNumber,
timeout: Duration(minutes: 1),
verificationCompleted: (AuthCredential phoneAuthCredential) async {
_smsController?.add('loading');
FirebaseUser firebaseUser = await FirebaseAuth.instance
.signInWithCredential(phoneAuthCredential);
_verifyUser(firebaseUser);
},
verificationFailed: (err) {
print(err.message);
print(err.code);
_smsController?.add('UNKNOWN_ERROR');
},
codeSent: (verificationId, [forceResendingToken]) {
_verificationId = verificationId;
_smsController?.add('code_sent');
},
codeAutoRetrievalTimeout: (verificationId) {},
);
}
错误消息:flutter: If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method.
flutter: verifyPhoneNumberError
3条答案
按热度按时间t98cgbkg1#
最佳可用解决方案AppDelegate.swift:
t40tm48m2#
我发现这在flutter仓库和目前的作品。
将当前的
firebase_auth
版本替换为6yoyoihd3#
由于我在flutter项目中使用firebase消息传递和电话身份验证,我也面临着同样的问题,FCM通知支持图像。在ImageNotification项目中
还有
这对我很有效谢谢。