Troubleshooting
An error code appears
If a BuzzvilSDK method call fails, Error is passed to the onFailure callback. Use the error code table below to identify the cause and resolve the problem.
| Error code | Cause | Resolution |
|---|---|---|
serverError | An error occurred on the Buzzvil server. | Send the error code to your Buzzvil representative. |
clientError | The request did not meet the requirements. (For example, an ad was requested before the user logged in.) | Check that the request arguments contain valid values. |
connectionTimeout | The network request timed out. | Check the network connection. |
emptyResponse | The network response is empty. (For example, an ad request succeeded but returned zero ads.) | Send the error code to your Buzzvil representative. |
waitingForResponse | This error can occur if you request another preload while a preload request is already being processed for BenefitHub. Ad allocation still proceeds normally when this error occurs. | Check that you have not requested a duplicate preload. |
agePolicy | The user is younger than the minimum age allowed to receive ads under the platform policy. | Set the age to 15 or older during login. |
privacyPolicyNotGranted | The user has not agreed to the privacy policy. | Check that the user agreed to the privacy policy before requesting ads. |
unknown | An unidentified error occurred. | Check for errors in the SDK integration and app build. |
The following example handles errors when requesting native ads.
let native = BuzzNative(unitId: "YOUR_NATIVE_UNIT_ID")
native.load(
onSuccess: { nativeAd in
// 할당된 광고가 있으면 호출됩니다.
},
onFailure: { error in
guard let error = error as? BuzzError else {
// BuzzErrorDomain에 속하지 않는 오류를 처리합니다.
return
}
switch error {
case .serverError:
print("server error")
case .clientError:
print("client error")
case .connectionTimeout:
print("connection timeout")
case .emptyResponse:
print("empty response")
case .waitingForResponse:
print("waiting for response")
case .agePolicy:
print("age policy")
case .privacyPolicyNotGranted:
print("privacy policy not granted")
case .unknown:
print("unknown error")
@unknown default:
break
}
}
)
BuzzNative *native = [[BuzzNative alloc] initWithUnitId:@"YOUR_NATIVE_UNIT_ID"];
[native loadWithOnSuccess:^(BuzzNativeAd * _Nonnull nativeAd) {
// 할당된 광고가 있으면 호출됩니다.
} onFailure:^(NSError * _Nonnull error) {
if ([error.domain isEqualToString:BuzzErrorDomain]) {
switch (error.code) {
case BuzzErrorCodeServerError:
NSLog(@"server error");
break;
case BuzzErrorCodeClientError:
NSLog(@"client error");
break;
case BuzzErrorCodeConnectionTimeout:
NSLog(@"connection timeout");
break;
case BuzzErrorCodeEmptyResponse:
NSLog(@"empty response");
break;
case BuzzErrorCodeWaitingForResponse:
NSLog(@"waiting for response");
break;
case BuzzErrorCodeAgePolicy:
NSLog(@"age policy");
break;
case BuzzErrorCodePrivacyPolicyNotGranted:
NSLog(@"privacy policy not granted");
break;
case BuzzErrorCodeUnknown:
NSLog(@"unknown error");
break;
default:
break;
}
} else {
// BuzzErrorDomain에 속하지 않는 오류를 처리합니다.
}
}];