与Dart:isolate冲突,当程序使用isolate处理慢速任务后,广告不能播放。
zengshu opened this issue · comments
描述
异常/需求具体描述
与Dart:isolate冲突,当程序使用isolate处理慢速任务后,广告不能播放。(至少影响开屏广告以及激励广告)
设备版本
本地flutter版本、设备型号版本
fluter版本3.7.8
开发环境Macbook Pro M1
测试iPhone13
插件版本
插件版本号
1.3.19,1.3.20等版本均有相同问题
日志
详细的log日志或者截图录屏
[general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1f240b0d8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'NSDictionary' (0x1f2403930) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
[general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1f240b0d8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{(
"'NSDictionary' (0x1f2403930) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
[connection] nw_connection_add_timestamp_locked_on_nw_queue [C3] Hit maximum timestamp count, will start dropping events
[connection] nw_connection_add_timestamp_locked_on_nw_queue [C22] Hit maximum timestamp count, will start dropping events
[connection] nw_connection_add_timestamp_locked_on_nw_queue [C4] Hit maximum timestamp count, will start dropping events
[connection] nw_connection_add_timestamp_locked_on_nw_queue [C1] Hit maximum timestamp count, will start dropping events
[connection] nw_connection_add_timestamp_locked_on_nw_queue [C2] Hit maximum timestamp count, will start dropping events
[Process] 0x130068640 - GPUProcessProxy::gpuProcessExited: reason=IdleExit
[Process] 0x13b0009d0 - [PID=14714] WebProcessProxy::gpuProcessExited: reason=IdleExit
可以参考 isolate与原生冲突 @zengshu
我这边倒不是isolate与原生冲突,isolate本身是正常返回数据了,UI等也都正常,但这时我所有的广告全都不能正常打开了。
是广告能显示,但是无法点击跳转?
我这边倒不是isolate与原生冲突,isolate本身是正常返回数据了,UI等也都正常,但这时我所有的广告全都不能正常打开了。
是广告能显示,但是无法点击跳转?
我这边倒不是isolate与原生冲突,isolate本身是正常返回数据了,UI等也都正常,但这时我所有的广告全都不能正常打开了。
不是的。
就我的程序需要处理图像,但速度很慢,所以我想在isolate中处理,这其中图像处理有调用platform channel,但没有和广告相关的任何东西。
图像处理完,能得到需要的结果,整个程序看起来是正常的。用户需要保存图像时,我需要触发激励广告,但这时就碰到问题:如果之前到图像处理没有使用isolate,那么广告可以正常调用;如果使用isolate处理的图像,那么广告就无法出来了。
我很奇怪为什么用isolate处理图像,就会导致广告无法正常调用,但现在也没啥思路。。
是否在新建的isolate中调用的广告展示方法?
如果是的话,可以尝试在需要播放广告的时候回传root isolate,在root isolate中触发展示广告
@zengshu
是否在新建的isolate中调用的广告展示方法? 如果是的话,可以尝试在需要播放广告的时候回传root isolate,在root isolate中触发展示广告 @zengshu
不是在isolate中调用的广告展示的方法,isolate中没有执行任何广告有关的东西。
我是在UI中触发的广告,代码如下:
OutlinedButton(
child: Text(
'Save',
style: Theme.of(context).textTheme.bodyMedium,
).tr(),
onPressed: () {
// Perform action based on selected option
if (_selectedOption != null) {
Navigator.of(context).pop();
if (_selectedOption == _options[0]) {
capture(_repaintBoundaryKey, widget.req,
isHighResolution: false,
quality: _quality);
} else if (_selectedOption == _options[1]) {
capture(_repaintBoundaryKey, widget.req,
isHighResolution: true,
quality: _quality);
} else if (_selectedOption == _options[2]) {
// Perform action for 5-inch layout
Navigator.of(context).pop();
_rewardName = null;
_rewardVerify = null;
_layoutInch = 5;
FlutterUnionad.loadRewardVideoAd(
//是否个性化 选填
androidCodeId: "123456789",
//Android 激励视频广告id 必填
iosCodeId: "987654321",
//ios 激励视频广告id 必填
supportDeepLink: true,
//是否支持 DeepLink 选填
rewardName: "STD_DL",
//奖励名称 选填
rewardAmount: 1,
//奖励数量 选填
userID: "123",
// 用户id 选填
orientation:
FlutterUnionadOrientation.VERTICAL,
//控制下载APP前是否弹出二次确认弹窗
downloadType: FlutterUnionadDownLoadType
.DOWNLOAD_TYPE_POPUP,
//视屏方向 选填
mediaExtra: null,
//扩展参数 选填
//用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,
adLoadType:
FlutterUnionadLoadType.PRELOAD,
);
} else if (_selectedOption == _options[3]) {
Navigator.of(context).pop();
_rewardName = null;
_rewardVerify = null;
_layoutInch = 6;
FlutterUnionad.loadRewardVideoAd(
//是否个性化 选填
androidCodeId: "123456789",
//Android 激励视频广告id 必填
iosCodeId: "987654321",
//ios 激励视频广告id 必填
supportDeepLink: true,
//是否支持 DeepLink 选填
rewardName: "STD_DL",
//奖励名称 选填
rewardAmount: 1,
//奖励数量 选填
userID: "123",
// 用户id 选填
orientation:
FlutterUnionadOrientation.VERTICAL,
//控制下载APP前是否弹出二次确认弹窗
downloadType: FlutterUnionadDownLoadType
.DOWNLOAD_TYPE_POPUP,
//视屏方向 选填
mediaExtra: null,
//扩展参数 选填
//用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,
adLoadType:
FlutterUnionadLoadType.PRELOAD,
);
}
}
},
),
而且广告失效以后,即使我重新initUnionad,广告也依然无法调用。
试试进入页面预加载激励广告,在Navigator.of(context).pop();前进行show展示