Aller au contenu principal
Version: 5.x.x

Error Handling

When BlueStackSDK encounters an error it fires the failed callback delegate with a BlueStackError class object.

Error codes

BlueStack SDK reports with following error codes:

Error CodeConstantDescription
0BlueStackErrorWrongPlacementThis error code represents an error that happened due to loading an ad with wrong placement Id
-1000BlueStackErrorAdServerAn ad server error occurred while loading the ad
-1001BlueStackErrorDataAdServerThe ad response contains wrong data
-999BlueStackErrorSDKUninitializedThis error happens if you try to load an ad before the sdk finishes it's initialization
-998BlueStackErrorCappedRequestAd request has been capped
-997BlueStackErrorLockedPlacementPlacement has been locked or already in process by another resource
-996BlueStackErrorBusyFactoryThis error will occur if you try to load multiple ads concurrently using same placement Id
-995BlueStackErrorBusyIf the SDK is busy loading one or more ads
-994BlueStackErrorUnallowedBackgroundRequestWhen SDK fails to send request while application is on background
-993BlueStackErrorNoAdsThis error occurs when there is no ad fill serving the placement Id
-992MAdvertiseErrorInterstitialCooldownIf the time between last interstitial disappear and create Interstitial less than 5s
-991BlueStackErrorAlreadyShownInterstitialIf you try to show an Interstitial ad while there is another Interstitial ad already showing
-990BlueStackErrorRequestTimedOutAd fails to load due to the request timed out
-989BlueStackErrorMissingViewControllerThis will happen if you do not provide root view controller while showing full screen ads and sdk is not able to found the top-most view controller
-988BlueStackErrorUnableToDisplayAdThis error happens when you try to show a full screen ad before it is done loading

Handling the Error

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

- (void)bannerView:(BannerView * _Nonnull)bannerView didFailedToLoadWithError:(NSError * _Nonnull)error { 
switch (error.code) {
case BlueStackErrorWrongPlacement:
NSLog(@"Wrong placement Id. %@", error.localizedDescription);
break;
case BlueStackErrorSDKUninitialized:
NSLog(@"BlueStackSDK is not initialized. %@", error.localizedDescription);
break;
default:
NSLog(@"Unhandled error");
break;
}
}