我使用 flutter Bloc 将用户导航到登录页面或主屏幕,具体取决于用户是否经过身份验证。但是,在初始状态更改后,当我更改身份验证状态时,侦听器不会触发。
听众:
Widget build(BuildContext context) {
return BlocListener<AuthenticationBloc, AuthenticationState>(
listener: (context, state) {
// Listener never gets called on statechange after the initial app startup
// navigation based on authentication
}
},
child: SplashPage(),
);
}
Run Code Online (Sandbox Code Playgroud)
提供者在父小部件中初始化:
AuthenticationRepository authRepo = AuthenticationRepository();
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider<AuthenticationBloc>(
create: (BuildContext context) =>
AuthenticationBloc(authenticationRepository: authRepo),
),
/*
Other Providers
*/
],
child: MaterialApp(
title: 'myApp',
home: StartUpPage(),
),
);
Run Code Online (Sandbox Code Playgroud)
当用户登录时,mapEventState 在 AuthenticationBloc 中被调用:
class AuthenticationBloc
extends …Run Code Online (Sandbox Code Playgroud) 每当我尝试在我的 iOS 应用程序的发布版本上加载广告时,我都会收到以下 admob 错误:
找不到名称为 ("com.google.DummyAdapter") 的广告网络适配器。请记住链接所有必需的广告网络适配器和 SDK,并在构建目标的“其他链接器标志”设置中设置 -ObjC。
我在我的 flutter 2.2.1 项目中使用了 google_mobile_ads 0.13.0 包。广告在应用程序的 android 版本上正确显示,我在 iOS 模拟器中从这些单元获取测试广告。
到目前为止,我已经尝试过:
使用的链接:
广告单元目前正被应用商店中的应用使用,而该项目正在 testflight 上进行测试。我不确定这是否对其有任何影响,看看广告如何在 android 上正常工作,android 也使用活动应用程序正在使用的单位。更改有效每千次展示费用不是一种选择,因为广告目前正在不同的实时应用中使用。但这会引发同样的问题,即为什么它适用于 android 和其他实时 iOS 应用程序。
我对 iOS 开发还是太陌生了,不知道是什么导致了这个错误,我非常感谢任何帮助解决这个问题。