Each time I’m calling loadAd()
perform both from onAppear()
or with a button click on, it is giving the error:
Fundamental thread blocked by synchronous property question on not-yet-loaded property (assetProperty_Tracks) for HTTP(S) asset. This might have been an issue if this asset had been being learn from a gradual community.
Fundamental thread blocked by synchronous property question on not-yet-loaded property (NaturalSize) for HTTP(S) asset. This might have been an issue if this asset had been being learn from a gradual community.
Fundamental thread blocked by synchronous property question on not-yet-loaded property (PreferredTransform) for HTTP(S) asset. This might have been an issue if this asset had been being learn from a gradual community.
Fundamental thread blocked by synchronous property question on not-yet-loaded property (EstimatedDataRate) for HTTP(S) asset. This might have been an issue if this asset had been being learn from a gradual community.
Fundamental thread blocked by synchronous property question on not-yet-loaded property (NominalFrameRate) for HTTP(S) asset. This might have been an issue if this asset had been being learn from a gradual community.
Leading to giving me “Advert wasn’t loaded”. Right here is my loadAd()
:
class AdCoordinator: NSObject, GADFullScreenContentDelegate, ObservableObject {
personal var advert: GADRewardedAd?
func loadAd() {
GADRewardedAd.load(
withAdUnitID: "ca-app-pub-3940256099942544/1712485313", request: GADRequest()
) { advert, error in
if let error = error {
return print("Did not load advert with error: (error.localizedDescription)")
}
self.advert = advert
self.advert?.fullScreenContentDelegate = self
}
}
func presentAd(from viewController: UIViewController) {
guard let fullScreenAd = advert else {
return print("Advert wasn't prepared")
}
fullScreenAd.current(fromRootViewController: viewController, userDidEarnRewardHandler: didEarnedReward) // didEarnedReward prints "reward earned"
}
}
The advert unit ID right here is from Google’s documentation.