iOS Admob how to check whether the ad has been loaded
**How to Check Whether an Ad Has Been Loaded**
When working with Google AdMob ads, it's often necessary to check whether an ad has been successfully loaded before displaying it to users. Here's how you can do that:
1. **Implement the adViewDid**Ad** delegate method.**
* In this method, you can set a global Boolean variable to indicate that an ad has been loaded.
2. **Check the global Boolean variable before displaying the ad.**
* If the variable is false, it means that an ad has not been loaded yet and you should not display it.
* If the variable is true, it means that an ad has been loaded and you can proceed with displaying it.
```
- (void)adViewDid**Ad**:(GAD**AdView *)**adView {
myGlobalBooleanThatSaysIfTheAd**Ad** = YES;
}
```
```
if (myGlobalBooleanThatSaysIfTheAd**Ad**) {
// Display the ad.
}
```
By following these steps, you can ensure that you only display ads that have been successfully loaded, which will improve the user experience and prevent any potential issues.