Aller au contenu principal
Version: 6.x.x

Error Handling

When BlueStack SDK encounters an error, it fires the failed callback delegate with an AdError object.

Error codes

BlueStack SDK reports with following error codes:

Error CodeConstantDescription
0AdErrorWrongPlacementWrong placement Id was provided when loading the ad
-1000AdErrorAdServerAn ad server error occurred while loading the ad
-1001AdErrorDataAdServerThe ad response contains invalid or malformed data
-1002AdErrorNoInternetNo internet connection is available to complete the ad request
-999AdErrorSDKUninitializedThe ad was requested before the SDK finished initialization
-998AdErrorCappedRequestThe ad request has been capped
-997AdErrorLockedPlacementThe placement is locked or already in use by another resource
-996AdErrorBusyFactoryMultiple ads are being loaded concurrently using the same placement Id
-995AdErrorBusyThe SDK is busy loading one or more ads
-994AdErrorUnallowedBackgroundRequestThe SDK cannot send a request while the application is in the background
-993AdErrorNoAdsNo ad fill is available for the given placement Id
-992AdErrorInterstitialCooldownThe time between the last interstitial dismiss and the new interstitial request is less than 5 seconds
-991AdErrorAlreadyShownInterstitialAnother interstitial ad is already being displayed
-990AdErrorAlreadyShownAppOpenAn app open ad is already being displayed
-989AdErrorRequestTimedOutThe ad request timed out before a response was received
-988AdErrorMissingViewControllerNo root view controller was provided and the SDK could not find the top-most view controller
-987AdErrorUnableToDisplayAdThe full-screen ad was requested to show before it finished loading
-986AdErrorAdExpiredThe ad has expired and can no longer be displayed
-985AdErrorNoAdapterFoundForPlacementNo mediation adapter was found for the given placement
-984AdErrorAdapterClassNotFoundThe mediation adapter class could not be found or loaded
-983AdErrorInternalAn internal SDK error occurred

Handling the Error

Following is an example of handling errors for an Banner Ad.

- (void)bannerView:(BLSBannerView * _Nonnull)bannerView didFailedToLoadWithError:(NSError * _Nonnull)error { 
switch (error.code) {
case AdErrorWrongPlacement:
NSLog(@"Wrong placement Id. %@", error.localizedDescription);
break;
case AdErrorSDKUninitialized:
NSLog(@"BlueStack SDK is not initialized. %@", error.localizedDescription);
break;
default:
NSLog(@"Unhandled error");
break;
}
}