Flutter / Firebase Phone Auth: Safari не может открыть страницу, чтобы проверить на симуляторе iOS ⇐ IOS
Flutter / Firebase Phone Auth: Safari не может открыть страницу, чтобы проверить на симуляторе iOS
Это сработало в первые пару раз, когда я пытался, но теперь я просто получу этот сафари, не может подключить ошибку. Интересно, что я делаю не так.Future signupWithPhoneNumber({
required String phoneNumber,
required BuildContext context,
required void Function(String verificationId) onCodeSent,
}) async {
try {
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: phoneNumber,
timeout: const Duration(seconds: 60),
verificationCompleted: (PhoneAuthCredential credential) async {
// Automatic verification (for example, on Android)
await FirebaseAuth.instance.signInWithCredential(credential);
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => Homepage()),
);
},
verificationFailed: (FirebaseAuthException e) {
String message = 'Phone verification failed: ${e.message}';
debugPrint(e.message);
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.CENTER,
backgroundColor: Colors.black54,
textColor: Colors.white,
fontSize: 14,
);
},
codeSent: (String verificationId, int? resendToken) {
onCodeSent(verificationId);
// Now you can show UI for the user to input the SMS code
},
codeAutoRetrievalTimeout: (String verificationId) {
// Called if automatic retrieval doesn't happen
},
);
} catch (e) {
Fluttertoast.showToast(
msg: 'Error signing up with phone: $e',
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.CENTER,
backgroundColor: Colors.grey,
textColor: Colors.white,
fontSize: 14,
);
}
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... -ios-simul
Это сработало в первые пару раз, когда я пытался, но теперь я просто получу этот сафари, не может подключить ошибку. Интересно, что я делаю не так.Future signupWithPhoneNumber({
required String phoneNumber,
required BuildContext context,
required void Function(String verificationId) onCodeSent,
}) async {
try {
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: phoneNumber,
timeout: const Duration(seconds: 60),
verificationCompleted: (PhoneAuthCredential credential) async {
// Automatic verification (for example, on Android)
await FirebaseAuth.instance.signInWithCredential(credential);
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => Homepage()),
);
},
verificationFailed: (FirebaseAuthException e) {
String message = 'Phone verification failed: ${e.message}';
debugPrint(e.message);
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.CENTER,
backgroundColor: Colors.black54,
textColor: Colors.white,
fontSize: 14,
);
},
codeSent: (String verificationId, int? resendToken) {
onCodeSent(verificationId);
// Now you can show UI for the user to input the SMS code
},
codeAutoRetrievalTimeout: (String verificationId) {
// Called if automatic retrieval doesn't happen
},
);
} catch (e) {
Fluttertoast.showToast(
msg: 'Error signing up with phone: $e',
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.CENTER,
backgroundColor: Colors.grey,
textColor: Colors.white,
fontSize: 14,
);
}
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... -ios-simul
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение