update rewardedloadcompletionHandler
update rewardedloadcompletionHandler
MODIFY
adapters/Unity/UnityAdapter/GADMAdapterUnity.m
adapters/Unity/UnityAdapter/GADMAdapterUnity.m
[UnityAds addDelegate:self];
[UnityAds load:[self getPlacementID]];
} else {
- id<GADMAdNetworkConnector> strongNetworkConnector = self->_networkConnector;
- if (strongNetworkConnector) {
+ if (strongConnector) {
NSError *errorWithDescription = GADUnityErrorWithDescription(message);
- [strongNetworkConnector adapter:self didFailAd:errorWithDescription];
+ [strongConnector adapter:self didFailAd:errorWithDescription];
}
}
};

MODIFY
adapters/Unity/UnityAdapter/GADMAdapterUnityBannerAd.m
adapters/Unity/UnityAdapter/GADMAdapterUnityBannerAd.m
[UnityAds addDelegate:self];
[UnityAds load:gameID];
} else {
- id<GADMAdNetworkConnector> strongConnector = self->_connector;
- id<GADMAdNetworkAdapter> strongAdapter = self->_adapter;
if (strongConnector && strongAdapter) {
[strongConnector adapter:strongAdapter didFailAd:GADUnityErrorWithDescription(message)];
}

MODIFY
adapters/Unity/UnityAdapter/GADMAdapterUnityRewardedAd.m
adapters/Unity/UnityAdapter/GADMAdapterUnityRewardedAd.m
#import "GADUnityError.h"
@interface GADMAdapterUnityRewardedAd () <GADMAdapterUnityDataProvider, UnityAdsExtendedDelegate> {
- // The completion handler to call when the ad loading succeeds or fails.
- GADMediationRewardedLoadCompletionHandler _adLoadCompletionHandler;
-
// Ad configuration for the ad to be rendered.
GADMediationAdConfiguration *_adConfiguration;
BOOL _isLoading;
}
+// The completion handler to call when the ad loading succeeds or fails.
+@property (nonatomic, copy)GADMediationRewardedLoadCompletionHandler adLoadCompletionHandler;
@end
@implementation GADMAdapterUnityRewardedAd
}
return;
}
+ GADMAdapterUnityRewardedAd *__weak weakSelf = self;
UnitySingletonCompletion completeBlock = ^(UnityAdsError *error, NSString *message) {
if(!error) {
[UnityAds load:[self getPlacementID]];
} else {
NSError *errorWithDescription = GADUnityErrorWithDescription(message);
- self->_adLoadCompletionHandler(nil, errorWithDescription);
- self->_adLoadCompletionHandler = nil;
+ if(weakSelf) {
+ weakSelf.adLoadCompletionHandler(nil, errorWithDescription);
+ }
}
};
[[GADMAdapterUnitySingleton sharedInstance] initializeWithGameID:_gameID
completeBlock:completeBlock];
-
}
- (void)presentFromViewController:(nonnull UIViewController *)viewController {
#pragma mark - Unity Delegate Methods
- (void)unityAdsDidError:(UnityAdsError)error withMessage:(nonnull NSString *)message {
-// id<GADMediationRewardedAdEventDelegate> strongDelegate = _adEventDelegate;
-// if (strongDelegate && error == kUnityAdsErrorShowError) {
-// NSError *presentError = GADUnityErrorWithDescription(message);
-// [_adEventDelegate didFailToPresentWithError:presentError];
-// }
-//
-// if (_adLoadCompletionHandler) {
-// NSError *errorWithDescription = GADUnityErrorWithDescription(message);
-// _adLoadCompletionHandler(nil, errorWithDescription);
-// _adLoadCompletionHandler = nil;
-// }
}
- (void)unityAdsDidFinish:(nonnull NSString *)placementID
}
[strongDelegate willDismissFullScreenView];
[strongDelegate didDismissFullScreenView];
- [strongDelegate didEndVideo];
[UnityAds removeDelegate:self];
}
}

update rewardedloadcompletionHandler

update rewardedloadcompletionHandler