You need to enable JavaScript to run this app. Xamarin.Forms iOS应用GAD自适应横幅广告相关函数崩溃,求调试方向
优惠活动
大模型
产品
解决方案
定价
更多

Xamarin.Forms iOS应用GAD自适应横幅广告相关函数崩溃,求调试方向

问题排查结论

你提供的崩溃栈所有调用帧均指向Google Mobile Ads(Admob)的GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth相关逻辑,崩溃类型为EXC_BAD_ACCESS KERN_PROTECTION_FAILURE,且发生在子线程(线程池工作线程),可以确定该崩溃和你使用的Xamarin.Google.iOS.MobileAds组件直接相关。


排查指引

  • 检查Admob API调用线程:iOS平台所有Admob相关操作(包括横幅广告尺寸获取、初始化、加载、展示)必须在主线程执行,你可以全局搜索项目中调用GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth的代码位置,确认所有调用都使用Device.BeginInvokeOnMainThread包裹,强制切换到主线程执行。
  • 验证依赖版本兼容性:你当前使用的Xamarin.Forms 5.0.0.1709-pre4为预览版,和Xamarin.Google.iOS.MobileAds 7.66.0存在已知的兼容性冲突。你可以先将Xamarin.Forms升级到5.0系列的最新正式版,或升级Admob组件到适配Xamarin.Forms 5.0的稳定版本,注意升级Admob后需要同步适配新版广告加载、初始化的API规范。
  • 检查广告实例生命周期管理:不要提前销毁正在加载、展示中的广告实例,尤其是自适应横幅广告,避免页面退出时立刻释放广告对象,可以延迟到页面完全销毁后再执行释放操作,避免野指针访问触发内存错误。
  • 本地复现定位:开启Admob调试模式,在测试设备上尝试复现崩溃,调试模式下会输出更详细的错误日志,同时可以排除正式环境广告填充的随机影响,更快定位具体的触发代码路径。

环境信息

  • Xamarin.Forms版本:5.0.0.1709-pre4
  • Xamarin.Google.iOS.MobileAds版本:7.66.0

崩溃栈信息

Crashed: Thread Pool Worker
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016e70ffe0

Crashed: Thread Pool Worker
0  AppName.iOS                  0x103f91a38 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 30094532
1  AppName.iOS                  0x1025103d0 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 2301532
2  AppName.iOS                  0x102510154 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 2300896
3  AppName.iOS                  0x10266b2a4 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 3722544
4  AppName.iOS                  0x10266d134 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 3730368
5  AppName.iOS                  0x10335a17c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 17284104
6  AppName.iOS                  0x103830148 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22354900
7  AppName.iOS                  0x103830250 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22355164
8  AppName.iOS                  0x103833884 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22369040
9  AppName.iOS                  0x10385b4a4 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
10 AppName.iOS                  0x10385b4f0 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
11 AppName.iOS                  0x10385b4a4 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
12 AppName.iOS                  0x10387dc80 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
13 AppName.iOS                  0x1025a258c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
14 AppName.iOS                  0x102529fac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
15 AppName.iOS                  0x102529dac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
16 AppName.iOS                  0x1025a2448 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
17 AppName.iOS                  0x102547070 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
18 AppName.iOS                  0x102540b08 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
19 AppName.iOS                  0x10253f0c0 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
20 AppName.iOS                  0x10253a054 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
21 AppName.iOS                  0x1025a0cdc GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
22 AppName.iOS                  0x102ffdb14 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
23 AppName.iOS                  0x1025a258c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
24 AppName.iOS                  0x102529fac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
25 AppName.iOS                  0x102529dac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
26 AppName.iOS                  0x1025a2448 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
27 AppName.iOS                  0x102547070 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
28 AppName.iOS                  0x102540b08 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
29 AppName.iOS                  0x10253f0c0 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
30 AppName.iOS                  0x10253a054 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
31 AppName.iOS                  0x1025a0cdc GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
32 AppName.iOS                  0x1030d3b1c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
33 AppName.iOS                  0x1025a258c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
34 AppName.iOS                  0x102529fac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
35 AppName.iOS                  0x102529dac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
36 AppName.iOS                  0x1025a2448 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
37 AppName.iOS                  0x102547070 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
38 AppName.iOS                  0x102540b08 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
39 AppName.iOS                  0x10253f0c0 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
40 AppName.iOS                  0x10253a054 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
41 AppName.iOS                  0x10253649c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
42 AppName.iOS                  0x1030d0d30 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
43 AppName.iOS                  0x10276cc28 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
44 AppName.iOS                  0x10253f5f4 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
45 AppName.iOS                  0x10253f868 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
46 AppName.iOS                  0x102529fac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
47 AppName.iOS                  0x102529dac GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
48 AppName.iOS                  0x102543718 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
49 AppName.iOS                  0x10253f780 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
50 AppName.iOS                  0x10253f658 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
51 AppName.iOS                  0x10252ef68 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
52 AppName.iOS                  0x1030d7620 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
53 AppName.iOS                  0x102531028 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
54 AppName.iOS                  0x1027b4760 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
55 AppName.iOS                  0x103e1c668 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
56 AppName.iOS                  0x103ed9648 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
57 AppName.iOS                  0x103f1cc94 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
58 AppName.iOS                  0x103f1a570 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
59 AppName.iOS                  0x103f25d08 GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531964
60 AppName.iOS                  0x103f25b8c GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth + 22531888
61 libsystem_pthread.dylib        0x1dbafcbfc _pthread_start + 22531964
62 libsystem_pthread.dylib        0x1dbb05758 thread_start + 22531888

内容的提问来源于stack exchange,提问作者Mac

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.16 03:36:03