2017-02-23 6 views
7

zdałem sobie sprawę Facebook Śródmiąższowe Ad wywala z MoPub Plugin kiedy sprawdzić awarii na organizatoraFacebook Śródmiąższowe Ad crash MoPub Plugin na Jedności

widzę śledzenia wstecznego na organizatora.

Chcę znaleźć prawdziwy plik do edycji i naprawić tę awarię.

To backtrace: Backtrace

I to jest sposób użyłem

Plik: AdSystem.cs

try { 
    MoPub.showInterstitialAd(adUnit.key1); 
} 
catch(Exception e) { 
} 

I to jest Facebook Śródmiąższowe Adapter do MoPub https://github.com/mopub/mopub-ios-sdk/tree/master/AdNetworkSupport/Facebook

Plik: FacebookInterstitialCustomEvent.m

// 
// FacebookInterstitialCustomEvent.m 
// MoPub 
// 
// Copyright (c) 2014 MoPub. All rights reserved. 
// 

#import <FBAudienceNetwork/FBAudienceNetwork.h> 
#import "FacebookInterstitialCustomEvent.h" 

#import "MPInstanceProvider.h" 
#import "MPLogging.h" 

@interface MPInstanceProvider (FacebookInterstitials) 

- (FBInterstitialAd *)buildFBInterstitialAdWithPlacementID:(NSString *)placementID 
                delegate:(id<FBInterstitialAdDelegate>)delegate; 

@end 

@implementation MPInstanceProvider (FacebookInterstitials) 

- (FBInterstitialAd *)buildFBInterstitialAdWithPlacementID:(NSString *)placementID 
                delegate:(id<FBInterstitialAdDelegate>)delegate 
{ 
    FBInterstitialAd *interstitialAd = [[FBInterstitialAd alloc] initWithPlacementID:placementID]; 
    interstitialAd.delegate = delegate; 
    return interstitialAd; 
} 

@end 

@interface FacebookInterstitialCustomEvent() <FBInterstitialAdDelegate> 

@property (nonatomic, strong) FBInterstitialAd *fbInterstitialAd; 

@end 

@implementation FacebookInterstitialCustomEvent 

- (void)requestInterstitialWithCustomEventInfo:(NSDictionary *)info 
{ 
    if (![info objectForKey:@"placement_id"]) { 
     MPLogError(@"Placement ID is required for Facebook interstitial ad"); 
     [self.delegate interstitialCustomEvent:self didFailToLoadAdWithError:nil]; 
     return; 
    } 

    MPLogInfo(@"Requesting Facebook interstitial ad"); 

    self.fbInterstitialAd = 
    [[MPInstanceProvider sharedProvider] buildFBInterstitialAdWithPlacementID:[info objectForKey:@"placement_id"] 
                    delegate:self]; 

    [self.fbInterstitialAd loadAd]; 
} 

- (void)showInterstitialFromRootViewController:(UIViewController *)controller { 
    if (!self.fbInterstitialAd || !self.fbInterstitialAd.isAdValid) { 
     MPLogError(@"Facebook interstitial ad was not loaded"); 
     [self.delegate interstitialCustomEventDidExpire:self]; 
    } else { 
     MPLogInfo(@"Facebook interstitial ad will be presented"); 
     [self.delegate interstitialCustomEventWillAppear:self]; 
     [self.fbInterstitialAd showAdFromRootViewController:controller]; 
     MPLogInfo(@"Facebook interstitial ad was presented"); 
     [self.delegate interstitialCustomEventDidAppear:self]; 
    } 
} 

- (void)dealloc 
{ 
    _fbInterstitialAd.delegate = nil; 
} 

#pragma mark FBInterstitialAdDelegate methods 

- (void)interstitialAdDidLoad:(FBInterstitialAd *)interstitialAd 
{ 
    MPLogInfo(@"Facebook intersitital ad was loaded. Can present now"); 
    [self.delegate interstitialCustomEvent:self didLoadAd:interstitialAd]; 
} 

- (void)interstitialAd:(FBInterstitialAd *)interstitialAd didFailWithError:(NSError *)error 
{ 
    MPLogInfo(@"Facebook intersitital ad failed to load with error: %@", error.description); 
    [self.delegate interstitialCustomEvent:self didFailToLoadAdWithError:nil]; 
} 

- (void)interstitialAdDidClick:(FBInterstitialAd *)interstitialAd 
{ 
    MPLogInfo(@"Facebook interstitial ad was clicked"); 
    [self.delegate interstitialCustomEventDidReceiveTapEvent:self]; 
} 

- (void)interstitialAdDidClose:(FBInterstitialAd *)interstitialAd 
{ 
    MPLogInfo(@"Facebook interstitial ad was closed"); 
    [self.delegate interstitialCustomEventDidDisappear:self]; 
} 

- (void)interstitialAdWillClose:(FBInterstitialAd *)interstitialAd 
{ 
    MPLogInfo(@"Facebook interstitial ad will close"); 
    [self.delegate interstitialCustomEventWillDisappear:self]; 
} 

@end 

Odpowiedz

0

Od oficjalnej stronie MoPub,

Należy Pre-sprowadzić pełnoekranową:

MoPub.requestInterstitialAd(interstitialAdUnit); 

W tym przypadku

MoPub.requestInterstitialAd(adUnit.key1); 

Następnie pokaż pełnoekranową:

MoPub.showInterstitialAd (interstitialAdUnit); 

W twoim przypadku,

MoPub.showInterstitialAd (adUnit.key1); 

Więc twoi AdSystem.cs plik powinien być

try { 
    MoPub.requestInterstitialAd(adUnit.key1); 
    MoPub.showInterstitialAd(adUnit.key1); 
} 
catch(Exception e) { 
} 

Te wozy zwrotnych pomoże zbyt

void onInterstitialLoaded (string adUnitId) 
void onInterstitialFailed (string errorMsg) 
void onInterstitialDismissed (string adUnitId) 
void interstitialDidExpire (string adUnitId) 
void onInterstitialShown (string adUnitId) 
void onInterstitialClicked (string adUnitId) 

Więcej szczegółów spójrz na Mopub's Official Documentation

+0

Dziękuję za odpowiedź. Już widzę pełnoekranowo. Mój kod działa idealnie, ale niektóre z urządzeń zawieszają się. Chcę tylko naprawić awarię. –

+0

Czy możesz podać 2 lub 3 nazwy przykładowych urządzeń. –

+0

Iphone 6s 10.2 Iphone SE 10.2 Iphone 5s 10.2.1 Iphone 6 10,2 myślę, że niektóre z Facebook Ads awarii. Jeśli naprawimy plik FacebookInterstitialCustomEvent.m za pomocą funkcji catch catch, możemy się pozbyć tej awarii? –