ios - flutter:如果禁用了应用代理调动,则 UIApplicationDelegate 收到的远程通知需要转发到 FIRAuth 的
问题描述
当我想使用带有 firebase 的 sms auth 时,该应用程序仅在 iOS 上失败
APN 证书已经在 firebase 上配置,FirebaseAppDelegateProxyEnabled
在Info.plist
. 在 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
解决方案
解决方案 :
我在颤振存储库中找到了这个,目前可以使用。
将当前firebase_auth
版本替换为
firebase_auth:
git:
url: https://github.com/collinjackson/plugins.git
ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
path: packages/firebase_auth
推荐阅读
- java - Eclipse STS Gradle 错误 - java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
- elixir - 如何在 Phoenix 中使用 2 个身份验证插件?
- javascript - Ember 通过一个出口传递一个动作闭包
- mysql - MySQL - 将所有 JSON 属性列为单独的列
- c - 我的代码没有像应有的那样输出三元组。可能是什么问题?
- php - PHP 可以模仿 MySQL utf8mb4_0900_ai_ci 排序规则吗?
- linux - 如何使用 sed 替换文本文件中声明的变量值
- arrays - 处理数组中的时间戳时丢失毫秒
- python - 我有错误消息“在线程 django-main-thread 中使用 StatReloader 异常更改文件:”
- python - 未能将 tensorflow==2.1.0 安装到 Cloud Functions 运行时 Python 3.7