14.6 C
New York
Monday, October 21, 2024

ios – AdMob storyboard crashes when gadget just isn’t in English


I am making an attempt to localize my SwiftUI app that has storyboards for AdMob native adverts but it surely retains crashing the app with an unrecognized selector despatched to occasion. This solely occurs when the gadget language just isn’t English.

Virtually your complete app is SwiftUI aside from the few storyboards for AdMob.

I’ve appropriately localized the SwiftUI and storyboard half. The code for initializing and displaying Advert is from the official AdMob documentation verbatim and works because it ought to.

I am fairly certain that that is an AdMob situation and the reason is that within the dump it says -[UIImageView setMediaContent:]... and setMediaContent is a AdMob operate nevertheless, within the documentation, I may solely discover it within the Android – Java part, not the iOS – Swift part for some motive…

Although, I’m fairly certain that this isn’t a localization situation however associated to the gadget set language. As talked about above, it would not crash solely when the gadget, each simulator and bodily, languages are set to English.

How do I not let AdMob crash when the gadget just isn’t English?

*** Terminating app attributable to uncaught exception 'NSInvalidArgumentException', motive: '-[UIImageView setMediaContent:]: unrecognized selector despatched to occasion 0x102b6e330'
*** First throw name stack:
(
    0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72
    2   CoreFoundation                      0x00000001804ccc54 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   UIKitCore                           0x0000000185ace7a8 -[UIResponder doesNotRecognizeSelector:] + 232
    4   CoreFoundation                      0x00000001804bb3ec ___forwarding___ + 1268
    5   CoreFoundation                      0x00000001804bdb0c _CF_forwarding_prep_0 + 92
    6   Now                                 0x0000000100f2bda8 GAD_GADNativeAdView_arm64_11_10_0 + 4476
    7   Now                                 0x0000000100fa8344 GADDispatchAsyncSafeMainQueue + 52
    8   Now                                 0x0000000100f2bbb0 GAD_GADNativeAdView_arm64_11_10_0 + 3972
    9   Basis                          0x0000000180ea9568 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 268
    10  UIKitCore                           0x000000018601b5a0 -[UIView(CALayerDelegate) setValue:forKey:] + 156
    11  UIKitCore                           0x00000001856b957c -[UIRuntimeOutletConnection connect] + 80
    12  CoreFoundation                      0x00000001804a3cd0 -[NSArray makeObjectsPerformSelector:] + 192
    13  UIKitCore                           0x00000001856acdac -[UINib instantiateWithOwner:options:] + 1420
    14  UIKitCore                           0x00000001856adf20 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 112
    15  Now                                 0x0000000100972e08 $s3Now12NativeAdView33_76C808047172D32F5B9EBA51A235A105LLV10makeUIView7contextSo09GADNativecD0C7SwiftUI0M20RepresentableContextVyADG_tF + 2120
    16  Now                                 0x0000000100975aa8 $s3Now12NativeAdView33_76C808047172D32F5B9EBA51A235A105LLV7SwiftUI19UIViewRepresentableAaeFP04makeN07context0N4TypeQzAE0nO7ContextVyxG_tFTW + 28
    17  SwiftUI                             0x00000001d23add64 $s7SwiftUI32PlatformViewRepresentableAdaptor33_19642D833A8FE469B137699ED1426762LLV04makeD8Provider7context10UIViewTypeQzAA0cdE7ContextVyADyxGG_tF + 228
    18  SwiftUI                             0x00000001d23ae0a0 $s7SwiftUI32PlatformViewRepresentableAdaptor33_19642D833A8FE469B137699ED1426762LLVyxGAA0cdE0A2aFP04makeD8Provider7context0cdM0QzAA0cdE7ContextVyxG_tFTW + 20
    19  SwiftUI                             0x00000001d231e71c $s7SwiftUI17PlatformViewChildV11updateValueyyFyyXEfU_AA0cD4HostCyxGSgyXEfU2_AHyXEfU_AGyXEfU_ + 292
    20  SwiftUI                             0x00000001d23234b8 $s7SwiftUI17PlatformViewChildV11updateValueyyFyyXEfU_AA0cD4HostCyxGSgyXEfU2_AHyXEfU_AGyXEfU_TA + 40
    21  SwiftUI                             0x00000001d21c4378 $s7SwiftUI26RepresentableContextValuesV9asCurrent2doxxyXE_tlF + 276
    22  SwiftUI                             0x00000001d231e5bc $s7SwiftUI17PlatformViewChildV11updateValueyyFyyXEfU_AA0cD4HostCyxGSgyXEfU2_AHyXEfU_ + 188
    23  SwiftUI                             0x00000001d2323378 $s7SwiftUI17PlatformViewChildV11updateValueyyFyyXEfU_AA0cD4HostCyxGSgyXEfU2_TA + 108
    24  SwiftUICore                         0x00000001d2ceee7c $s7SwiftUI16_withObservation2dox5value_0D00D8TrackingV11_AccessListVSg06accessI0txyKXE_tKlFxSpyAJGKXEfU_ + 84
    25  SwiftUICore                         0x00000001d299a048 $s7SwiftUI16_withObservation2dox5value_0D00D8TrackingV11_AccessListVSg06accessI0txyKXE_tKlFxSpyAJGKXEfU_TA + 24
    26  SwiftUICore                         0x00000001d2b36488 $ss17withUnsafePointer2to_q0_x_q0_SPyxGq_YKXEtq_YKs5ErrorR_Ri_zRi_0_r1_lF + 72
    27  SwiftUICore                         0x00000001d2cee560 $s14AttributeGraph12StatefulRuleP7SwiftUIE15withObservation2doqd__qd__yKXE_tKlFTm + 544
    28  SwiftUICore                         0x00000001d2cee2b8 $s14AttributeGraph12StatefulRuleP7SwiftUIE15withObservation2doqd__qd__yKXE_tKlF + 56
    29  SwiftUI                             0x00000001d231d7a8 $s7SwiftUI17PlatformViewChildV11updateValueyyFyyXEfU_ + 2372
    30  SwiftUICore                         0x00000001d2988d38 $s7SwiftUI8SignpostV13traceInterval6object__7closurexyXlSg_s12StaticStringVSays7CVarArg_pGyXKxyXEtlF + 344
    31  SwiftUI                             0x00000001d231cd20 $s7SwiftUI17PlatformViewChildV11updateValueyyF + 164
    32  SwiftUI                             0x00000001d15f8548 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_TA + 28
    33  AttributeGraph                      0x00000001bdf35f7c _ZN2AG5Graph11UpdateStack6updateEv + 532
    34  AttributeGraph                      0x00000001bdf367cc _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 432
    35  AttributeGraph                      0x00000001bdf3e438 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjjPK15AGSwiftMetadataRhl + 716
    36  AttributeGraph                      0x00000001bdf53f9c AGGraphGetValue + 232
    37  SwiftUI                             0x00000001d231fd1c $s7SwiftUI31InvalidatableLeafLayoutComputer33_A513612C07DFA438E70B9FA90719B40DLLV4viewAA04ViewdO0VyxGvgTm + 56
    38  SwiftUI                             0x00000001d231f478 $s7SwiftUI31InvalidatableLeafLayoutComputer33_A513612C07DFA438E70B9FA90719B40DLLV11updateValueyyF + 208
    39  SwiftUI                             0x00000001d15f8548 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_TA + 28
    40  AttributeGraph                      0x00000001bdf35f7c _ZN2AG5Graph11UpdateStack6updateEv + 532
    41  AttributeGraph                      0x00000001bdf367cc _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 432
    42  AttributeGraph                      0x00000001bdf3e258 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjjPK15AGSwiftMetadataRhl + 236
    43  AttributeGraph                      0x00000001bdf53d60 AGGraphGetInputValue + 248
    44  SwiftUICore                         0x00000001d2a34998 $s7SwiftUI11LayoutProxyV25requiresSpacingProjectionSbvg + 88
    45  SwiftUICore                         0x00000001d2d237bc $s7SwiftUI12_FrameLayoutV7spacing2in5childAA7SpacingVAA07SizeAndH7ContextV_AA0D5ProxyVtF + 204
    46  SwiftUICore                         0x00000001d2d23c10 $s7SwiftUI12_FrameLayoutVAA05UnaryD0A2aDP7spacing2in5childAA7SpacingVAA07SizeAndI7ContextV_AA0D5ProxyVtFTW + 40
    47  SwiftUICore                         0x00000001d2bb338c $s7SwiftUI17UnaryLayoutEngine33_1C3B77B617AD058A6802F719E38F5D79LLV7spacingAA7SpacingVyF + 76
    48  SwiftUICore                         0x00000001d2dcf3dc $s7SwiftUI15LayoutEngineBox33_91FCB5522C30220AE13689E45789FEF2LLC7spacingAA7SpacingVyF + 36
    49  SwiftUICore                         0x00000001d29a0abc $s7SwiftUI14_PaddingLayoutV7spacing2in5childAA7SpacingVAA07SizeAndH7ContextV_AA0D5ProxyVtF + 520
    50  SwiftUICore                         0x00000001d29a1004 $s7SwiftUI14_PaddingLayoutVAA05UnaryD0A2aDP7spacing2in5childAA7SpacingVAA07SizeAndI7ContextV_AA0D5ProxyVtFTW + 40
    51  SwiftUICore                         0x00000001d2bb338c $s7SwiftUI17UnaryLayoutEngine33_1C3B77B617AD058A6802F719E38F5D79LLV7spacingAA7SpacingVyF + 76
    52  SwiftUICore                         0x00000001d2dcf3dc $s7SwiftUI15LayoutEngineBox33_91FCB5522C30220AE13689E45789FEF2LLC7spacingAA7SpacingVyF + 36
    53  SwiftUICore                         0x00000001d27d8e48 $s7SwiftUI13_ZStackLayoutV7spacing8subviews5cacheAA11ViewSpacingVAA0D8SubviewsV_ytztF + 804
    54  SwiftUICore                         0x00000001d2be2d40 $s7SwiftUI16ViewLayoutEngineV7spacingAA7SpacingVyF + 120
    55  SwiftUICore                         0x00000001d2dcf3dc $s7SwiftUI15LayoutEngineBox33_91FCB5522C30220AE13689E45789FEF2LLC7spacingAA7SpacingVyF + 36
    56  SwiftUICore                         0x00000001d2e796e8 $s7SwiftUI11StackLayoutV12makeChildren33_00690F480F8D293143B214DBE6D72CD0LLyyF + 732
    57  SwiftUICore                         0x00000001d2a05aec $s7SwiftUI6VS
libc++abi: terminating attributable to uncaught exception of sort NSException

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles