如何解决Firebase自动登录在iOS上失败
我正在使用Flutter开发应用程序。当用户在android设备上登录应用程序,终止该应用程序并再次打开该应用程序时,我遇到了错误,_firebaseAuth.currentUser返回当前用户详细信息,但是在iOS上执行相同操作时,它返回null。任何人都可以建议为什么会这样。插件版本为firebase_auth 0.18.0 + 1。共享代码以检查 `
bool isSignedIn() {
try {
final currentUser = _firebaseAuth.currentUser;
return currentUser != null;
} catch (error) {
return false;
}
}
` 我用过这样的集团
`
runApp(BlocProvider(
create: (_) => AuthBloc(userRepository: _userRepository)..add(AppStarted()),child: MyApp(),));
`
`
Stream<AuthState> _mapAppStarted() async* {
try {
final isSignedIn = _userRepository.isSignedIn();
if (isSignedIn) {
final user = await _userRepository.getUser();
if (user == null) {
await _userRepository.signOut();
yield Unauthenticated();
} else {
List<FollowedFollowingModel> followedFollowingList =
await getFollowingList(user);
yield Authenticated(user,followedFollowingList);
}
} else {
yield Unauthenticated();
}
} catch (_) {
yield Unauthenticated();
}
}
`
解决方法
在<?php
$arrayName = array('Test','Testing','Test','Testing again','Testing');
for($i=0;$i<count($arrayName);$i++){
$c=1;
for($j=$i+1;$j<count($arrayName);$j++){
if($arrayName[$i]==$arrayName[$j]){
$arrayName[$j].=$c;
$c++;
}
}
}
for($i=0;$i<count($arrayName);$i++){
echo $arrayName[$i].'<br>';
}
?>
内的main.dart文件中,您可以像下面这样使用它:
Material widget
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。