I am using Managed Expo SDK 45. I know that expo-ads-admob is going to be deprecated in SDK 46 but I still find it a very good package and I'd like to use it.
Firstly, I have the code running on another SDK (38) and it works perfectly and now this problem is only in IOS - android works fine also on physical device, so it is not a problem with the code, but with expo-ads-admob package or expo.
The problem is that on physical device, interstitial ads will only be shown once, let's say I have a button and when I click on it for the first time - the ad is shown, but when I close the interstitial ad and try to click the button again - it won't do anything.
I checked the logs and I saw this:
"code":"E_AD_CANNOT_PRESENT",
"message":"Add cannot be prestnted",
"domain":"com.google.admob",
"userInfo":
{
"NSLocalizedDescription":"Presntation on Error: Will not present ad because ad object has been used."
}
I was looking the answer everywhere but I can't find a solution for this - this happens only in iOS physical devices and I think it happens to everyone using the new SDK.
I looked inside node_modules/expo-ads-admob/ios/EXAdsAdMobInterstitial.m and saw this:
EX_EXPORT_METHOD_AS(requestAd,
requestAdWithAdditionalRequestParams:(NSDictionary *)additionalRequestParams
resolver:(EXPromiseResolveBlock)resolve
rejecter:(EXPromiseRejectBlock)reject)
{
EX_WEAKIFY(self)
if (_ad) {
dispatch_async(dispatch_get_main_queue(), ^{
EX_ENSURE_STRONGIFY(self);
NSError *error;
if ([self.ad canPresentFromRootViewController:self.utilities.currentViewController error:&error]) {
[self requestAdWithParams:additionalRequestParams
resolver:resolve
rejecter:reject];
} else {
reject(@"E_AD_CANNOT_PRESENT", @"Add cannot be presented", error);
}
});
} else {
[self requestAdWithParams:additionalRequestParams
resolver:resolve
rejecter:reject];
}
}
But I don't know what it means and how I can fix it from this file. Is there a solution for this?
Thanks in advance