firebase / firebase-cpp-sdk

Firebase C++ SDK
http://firebase.google.com
Apache License 2.0
271 stars 109 forks source link

[Bug] GADRequestConfiguration setTagForUnderAgeOfConsent: unrecognized selector sent to instance #1594

Open solodon4 opened 1 month ago

solodon4 commented 1 month ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

While trying to initialize AdMob, I call firebase::gma::SetRequestConfiguration, which ends up throwing an Objective-C exception stating: -[GADRequestConfiguration setTagForUnderAgeOfConsent:]: unrecognized selector sent to instance 0x283a12640

The issue is likely related to pull request: #1537 where it states among changes:

Breaking changes in GADRequestConfiguration:

Steps to reproduce:

Reproduces 100% of time in my project, haven't tried to repro on Quickstart. The problem started occurring in Firebase C++ SDK 11.10.0 as I noticed it before and had to always roll back to 11.9.0 where the initialization happens with no issues. When I comment out call to firebase::gma::SetRequestConfiguration, the rest of the initialization and app run also goes without issues.

What happened? How can we make the problem occur? See the code below I use for initialization, which works fine in 11.9.0

Here is log output with identifiers replaced with XXXX:

2024-05-17 16:52:18.275311-0700 Metal-mobile[21205:3847959] Loading UIApplication category for Firebase App
2024-05-17 16:52:19.266542-0700 Metal-mobile[21205:3848134] 10.25.0 - [FirebaseCore][I-COR000005] No app has been configured yet.
2024-05-17 16:52:20.023556-0700 Metal-mobile[21205:3847959] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
2024-05-17 16:52:20.023762-0700 Metal-mobile[21205:3847959] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
2024-05-17 16:52:20.168308-0700 Metal-mobile[21205:3847959] [Firebase/Crashlytics] Version 10.25.0
2024-05-17 16:52:20.232959-0700 Metal-mobile[21205:3847959] 
---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 10.25.0
System information: OS iOS, OS version 16.2, model iPhone
Current date 2024-05-17 23:52:20 +0000
Device locale en-US (raw en_US), timezone America/Los_Angeles
    Specified custom URL scheme is com.example.app and Info.plist contains such scheme in CFBundleURLTypes key.
    AppID Prefix: XXXXXXXXXX, Team ID: XXXXXXXXXX, AppId Prefix equal to Team ID: YES
performDiagnostic completed successfully! No errors found.
---- Firebase Dynamic Links diagnostic output end ----
2024-05-17 16:52:20.367782-0700 Metal-mobile[21205:3848179] 10.25.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.10.25.0 started
2024-05-17 16:52:20.375021-0700 Metal-mobile[21205:3848179] 10.25.0 - [FirebaseAnalytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2024-05-17 16:52:20.439030-0700 Metal-mobile[21205:3848148] 10.25.0 - [FirebaseAnalytics][I-ACS044000] GoogleAppMeasurementIdentitySupport dependency is linked.
2024-05-17 16:52:20.439654-0700 Metal-mobile[21205:3848148] 10.25.0 - [FirebaseAnalytics][I-ACS044001] The AdSupport Framework is linked.
2024-05-17 16:52:20.532517-0700 Metal-mobile[21205:3848170] 10.25.0 - [FirebaseAnalytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 14160.20392107964
2024-05-17 16:52:20.587543-0700 Metal-mobile[21205:3847959] applicationSupportDirectory: '/var/mobile/Containers/Data/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Library/Application Support'
2024-05-17 16:52:20.587958-0700 Metal-mobile[21205:3847959] [logging] misuse at line 179186 of [554764a6e7]
2024-05-17 16:52:20.589496-0700 Metal-mobile[21205:3847959] applicationSupportDirectory: '/var/mobile/Containers/Data/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Library/Application Support'
2024-05-17 16:52:20.597771-0700 Metal-mobile[21205:3847959] applicationSupportDirectory: '/var/mobile/Containers/Data/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Library/Application Support'
2024-05-17 16:52:20.618526-0700 Metal-mobile[21205:3847959] Using Auth Prod for testing.
2024-05-17 16:52:20.623696-0700 Metal-mobile[21205:3847959] <UMP SDK> To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[ @"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ];
2024-05-17 16:52:20.625603-0700 Metal-mobile[21205:3847959] -[GADRequestConfiguration setTagForUnderAgeOfConsent:]: unrecognized selector sent to instance 0x283a12640

as well as the call stack:

* thread #1, name = 'App Main', queue = 'com.apple.main-thread', stop reason = hit Objective-C exception
    frame #0: 0x000000018c311920 libobjc.A.dylib`objc_exception_throw
    frame #1: 0x0000000192f520f0 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    frame #2: 0x0000000192e06bd8 CoreFoundation`___forwarding___ + 1340
    frame #3: 0x0000000192e6a6ec CoreFoundation`_CF_forwarding_prep_0 + 92
    frame #4: 0x000000010598d4b4 Metal-mobile`firebase::gma::SetRequestConfiguration(firebase::gma::RequestConfiguration const&) + 1712
  * frame #5: 0x000000010506c44c Metal-mobile`others::initialize() [inlined] initialize_admob(app=0x0000000108138700) at plugins.cpp:2574:5 [opt]
    frame #6: 0x000000010506c368 Metal-mobile`others::initialize() at plugins.cpp:4356:5 [opt]
    frame #7: 0x0000000104fc3260 Metal-mobile`AppDelegate::applicationDidFinishLaunching(this=<unavailable>) at AppDelegate.cpp:443:5 [opt]
    frame #8: 0x000000010561ec08 Metal-mobile`cocos2d::Application::run() + 20
    frame #9: 0x000000010511b3b4 Metal-mobile`-[AppController application:didFinishLaunchingWithOptions:](self=0x00000002830c7760, _cmd=<unavailable>, application=<unavailable>, launchOptions=<unavailable>) at AppController.mm:109:10 [opt]
    frame #10: 0x00000001951cac48 UIKitCore`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 296
    frame #11: 0x00000001951ca38c UIKitCore`-[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2776
    frame #12: 0x00000001951c93c0 UIKitCore`-[UIApplication _runWithMainScene:transitionContext:completion:] + 852
    frame #13: 0x00000001951c9020 UIKitCore`-[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 128
    frame #14: 0x0000000194f30314 UIKitCore`_UIScenePerformActionsWithLifecycleActionMask + 92
    frame #15: 0x0000000195249d84 UIKitCore`__101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 188
    frame #16: 0x000000019510a908 UIKitCore`-[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 212
    frame #17: 0x000000019510a738 UIKitCore`-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 588
    frame #18: 0x000000019510a308 UIKitCore`-[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248
    frame #19: 0x000000019510a1e8 UIKitCore`__186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 140
    frame #20: 0x0000000195781204 UIKitCore`+[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 656
    frame #21: 0x0000000195810280 UIKitCore`_UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 196
    frame #22: 0x0000000194fc7598 UIKitCore`-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 288
    frame #23: 0x00000001953fd9fc UIKitCore`__64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.189 + 552
    frame #24: 0x000000019508f13c UIKitCore`-[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 208
    frame #25: 0x000000019508efd0 UIKitCore`-[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220
    frame #26: 0x000000019508e53c UIKitCore`-[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 496
    frame #27: 0x000000019508e2e0 UIKitCore`-[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 260
    frame #28: 0x00000001a7676078 FrontBoardServices`-[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 316
    frame #29: 0x00000001a76b01f0 FrontBoardServices`__92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.59 + 92
    frame #30: 0x00000001a7679a14 FrontBoardServices`-[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 160
    frame #31: 0x00000001a76afe78 FrontBoardServices`__92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 296
    frame #32: 0x00000001076cd8c4 libdispatch.dylib`_dispatch_client_callout + 16
    frame #33: 0x00000001076d0dac libdispatch.dylib`_dispatch_block_invoke_direct + 228
    frame #34: 0x00000001a7682f18 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 44
    frame #35: 0x00000001a7682b54 FrontBoardServices`-[FBSSerialQueue _targetQueue_performNextIfPossible] + 176
    frame #36: 0x00000001a7685104 FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 24
    frame #37: 0x0000000192eb4298 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
    frame #38: 0x0000000192ebfbf8 CoreFoundation`__CFRunLoopDoSource0 + 172
    frame #39: 0x0000000192e49f58 CoreFoundation`__CFRunLoopDoSources0 + 232
    frame #40: 0x0000000192e5ef84 CoreFoundation`__CFRunLoopRun + 780
    frame #41: 0x0000000192e63b58 CoreFoundation`CFRunLoopRunSpecific + 584
    frame #42: 0x00000001c9063984 GraphicsServices`GSEventRunModal + 160
    frame #43: 0x000000019520e628 UIKitCore`-[UIApplication _run] + 868
    frame #44: 0x000000019520e2a0 UIKitCore`UIApplicationMain + 312
    frame #45: 0x0000000105123ba4 Metal-mobile`main(argc=<unavailable>, argv=<unavailable>) at main.m:24:16 [opt]
    frame #46: 0x00000001afb2ddf0 dyld`start + 2096

Relevant Code:

    ::firebase::InitResult am_res;
#if defined(__ANDROID__)
    ::firebase::Future<::firebase::gma::AdapterInitializationStatus> future = ::firebase::gma::Initialize(meta::non_null(cocos2d::JniHelper::getEnv()), meta::non_null(cocos2d::JniHelper::getActivity()), &am_res);
#else
    ::firebase::Future<::firebase::gma::AdapterInitializationStatus> future = ::firebase::gma::Initialize(*app, &am_res);
#endif

    firebase::gma::RequestConfiguration configuration = {
      .max_ad_content_rating            = firebase::gma::RequestConfiguration::kMaxAdContentRatingPG,
      .tag_for_child_directed_treatment = firebase::gma::RequestConfiguration::kChildDirectedTreatmentTrue,
      .tag_for_under_age_of_consent     = firebase::gma::RequestConfiguration::kUnderAgeOfConsentFalse,
      .test_device_ids = {
             // ...
      }
    };
    firebase::gma::SetRequestConfiguration(configuration); ///< Exception happens inside this call
google-oss-bot commented 1 month ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.