檢視 Mopub Mediation Banner 的原始碼
←
Mopub Mediation Banner
跳至導覽
跳至搜尋
由於下列原因,您沒有權限進行編輯此頁面的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
依照[[Mopub Setting|Mopub設定教學]]設定後,開始實做Custom event<br> 官方教學:[https://github.com/mopub/mopub-ios-sdk/wiki/Custom-Events 連結]<br> 1.先建立一class繼承MPBannerCustomEvent,class名稱必須與Mopub設定內一樣<br> 2.加入#import <TAMediaAdsFramework/TAMediaAdsFramework.h> <br> 3.複寫<code>- (void)requestAdWithSize:(CGSize)size customEventInfo:(NSDictionary *)info</code>以及在此method內用TADBannerView呼叫廣告<br> 4.在TADBannerView delegate內呼叫MPBannerCustomEvent delegate執行相對應的method<br> 可參考以下代碼 [[MoPub Mediation Setting|回MoPub教學]] == TAMediaCustomBannerEvent == '''// TAMediaCustomBannerEvent.h''' //匯入TADBannerVIew #import "MPBannerCustomEvent.h" #import <TAMediaAdsFramework/TAMediaAdsFramework.h> @interface TAMediaCustomBannerEvent : MPBannerCustomEvent<TADBannerViewDelegate> @property (nonatomic, strong) TADBannerView *bannerView; @end #import "TAMediaCustomBannerEvent.h" @implementation TAMediaCustomBannerEvent - (void)requestAdWithSize:(CGSize)size customEventInfo:(NSDictionary *)info { TADRequest *request = [TADRequest request]; request.testing = NO; request.gender = kTADGenderUnknown; [request setBirthdayWithYear:1988 month:6 day:11]; [request setLocationWithLatitude:25.033534 longitude:121.534791 accuracy:1]; if (!self.bannerView) { self.bannerView = [[TADBannerView alloc] initWithAdSize:TADAdSizeFromCGSize(size)]; } self.bannerView.delegate = self; self.bannerView.turnOnMicrophone = NO; NSString *bannerId = info[@"BannerId"];'''//此處BannerId是在Mopub內設定''' self.bannerView.adUnitID = bannerId; self.bannerView.rootViewController = [[UIApplication sharedApplication] keyWindow].rootViewController; [self.bannerView loadRequest:request]; } #pragma mark - [Tamedia Banner delegate] - (void)adViewDidReceiveAd:(TADBannerView *)view { if ([self.delegate respondsToSelector:@selector(bannerCustomEvent:didLoadAd:)]) { [self.delegate bannerCustomEvent:self didLoadAd:view]; } } - (void)adView:(TADBannerView *)view didFailToReceiveAdWithError:(TADRequestError *)error { if ([self.delegate respondsToSelector:@selector(bannerCustomEvent:didFailToLoadAdWithError:)]) { [self.delegate bannerCustomEvent:self didFailToLoadAdWithError:error]; } } - (void)adViewWillPresentScreen:(TADBannerView *)adView { } - (void)adViewWillDismissScreen:(TADBannerView *)adView { } - (void)adViewDidDismissScreen:(TADBannerView *)adView { } - (void)adViewWillLeaveApplication:(TADBannerView *)adView { if ([self.delegate respondsToSelector:@selector(bannerCustomEventWillLeaveApplication:)]) { [self.delegate bannerCustomEventWillLeaveApplication:self]; } } - (void)dealloc { if (self.bannerView != nil) { self.bannerView.delegate = nil; self.bannerView = nil; } } @end
返回到「
Mopub Mediation Banner
」。
導覽選單
個人工具
登入
命名空間
頁面
討論
變體
已展開
已摺疊
視圖
閱讀
檢視原始碼
檢視歷史
更多
已展開
已摺疊
搜尋
導覽
首頁
近期變更
隨機頁面
有關 MediaWiki 的說明
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊