Skip to content

Commit

Permalink
fix(banner, ios): fixed memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
birdofpreyru authored May 2, 2024
1 parent 2d8bdb5 commit 5cbf0e9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,17 @@ - (void)requestAd {
[self addSubview:_banner];
_banner.adUnitID = _unitId;
[self setRequested:YES];
__weak typeof(self) weakSelf = self;
_banner.paidEventHandler = ^(GADAdValue *_Nonnull value) {
[self sendEvent:@"onPaid"
payload:@{
@"value" : value.value,
@"precision" : @(value.precision),
@"currency" : value.currencyCode,
}];
typeof(self) strongSelf = weakSelf;
if (strongSelf) {
[strongSelf sendEvent:@"onPaid"
payload:@{
@"value" : value.value,
@"precision" : @(value.precision),
@"currency" : value.currencyCode,
}];
}
};
[_banner loadRequest:[RNGoogleMobileAdsCommon buildAdRequest:_request]];
[self sendEvent:@"onSizeChange"
Expand Down

0 comments on commit 5cbf0e9

Please sign in to comment.