I’m incorporating the Google Mobile Ads C++ SDK into my iOS Axmol (formerly Cocos2d-x) app. I’ve based my approach on these instructions and the code in this test app. In AppDelegate.cpp, in the applicationDidFinishLaunching function, I have the following code:
firebase::App* app;
firebase::InitResult result;
firebase::Future<firebase::gma::AdapterInitializationStatus> future;
app = ::firebase::App::Create();
future = firebase::gma::Initialize(*app, &result);
if (result != firebase::kInitResultSuccess)
{
// Handle errors
}
while (!ProcessEvents(1000))
{
if (future.status() != firebase::kFutureStatusPending)
{
break;
}
}
The result comes back with a value of kInitResultSuccess (I removed the error handling code for brevity). However, the above loop never exits. The initialization never completes. I’ve been over the configuration steps and can’t find the reason. Here’s a bit about my environment and settings:
macOS 14.2.1
Xcode 15.1
iOS 14.8.1
Firebase c++ SDK 11.9.0 (firebase.xcframework, firebase_gma.xcframework)
CocoaPods 1.15.2 (Firebase/CoreOnly, Google-Mobile-Ads-SDK, GoogleUserMessagingPlatform)
As per the instructions, I created a Firebase project using the Bundle ID and Team ID from my application, generated the GoogleService-Info.plist file, and imported the file into my application. I created a Google AdMob app and used its App ID in the modifications to my application’s Info.plist file shown below:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-5442191671867469~3525784565</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
</dict>
</array>
In AppController.mm, in the didFinishLaunchingWithOptions function, I added the line below:
[FIRApp configure];
I’m running out of ideas. Would anyone know of a solution to the permanently pending initialization? I would be grateful for any insights you could provide. Thanks for listening.
FHBlah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.