2

I have a live app on AppStore that uses Facebook Audience Network (FAN) for showing ads. The live version uses FAN SDK v 4.26.0 and successfully shows native and interstitial ads. However the latest development version of the app uses FAN SDK v 4.99.1. The same Ad Placement IDs are used for interstitial and native ads. Even though the app is getting the ads but gets crashed after some time raising exception that the ad is not valid.

Uncaught exception: Native ad <FBNativeAd: 0x180a7d60> passed to <FBAdGenericHeight300View: 0x180c9360; 
frame = (0 0; 0 0); layer = <CALayer: 0x182916b0>>, but the native ad is not valid.

Here is the Crash Log:

OS Version:          iPhone OS 10.3.3 (14G60)

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
0   CoreFoundation                  0x1cc2fb38 __exceptionPreprocess + 124
1   libobjc.A.dylib                 0x1beb7062 objc_exception_throw + 33
2   CoreFoundation                  0x1cc2fa80 +[NSException raise:format:] + 103
3   MyAwesomeApp                        0x0036c744 -[FBNativeAdView initWithNativeAd:withType:withAttributes:] + 3438404 (FBNativeAdView.m:88)
4   MyAwesomeApp                        0x0036c48e +[FBNativeAdView nativeAdViewWithNativeAd:withType:withAttributes:] + 3437710 (FBNativeAdView.m:67)
5   MyAwesomeApp                        0x0036c418 +[FBNativeAdView nativeAdViewWithNativeAd:withType:] + 3437592 (FBNativeAdView.m:61)
6   MyAwesomeApp                        0x0003ac0e -[MyAwesomeApp nativeAdDidLoad:] + 89102 (SearchViewController.m:2659)
7   MyAwesomeApp                        0x00360c76 -[FBNativeAd nativeAdBaseDidLoad:] + 3390582 (FBNativeAd.m:138)
8   MyAwesomeApp                        0x0036242c __90-[FBNativeAdBase displayAdController:presentedData:onImpression:onImpressionMiss:onClick:]_block_invoke + 3396652 (FBNativeAdBase.m:337)
9   MyAwesomeApp                        0x00361fea __51-[FBNativeAdBase downloadMediaFromData:completion:]_block_invoke_2 + 3395562 (FBNativeAdBase.m:301)
10  libdispatch.dylib               0x1c2fd792 _dispatch_call_block_and_release + 5
11  libdispatch.dylib               0x1c2fd77e _dispatch_client_callout + 17
12  libdispatch.dylib               0x1c301d00 _dispatch_main_queue_callback_4CF + 897
13  CoreFoundation                  0x1cbebd64 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 3
14  CoreFoundation                  0x1cbe9e14 __CFRunLoopRun + 843
15  CoreFoundation                  0x1cb3d1aa CFRunLoopRunSpecific + 465
16  CoreFoundation                  0x1cb3cfcc CFRunLoopRunInMode + 99
17  GraphicsServices                0x1e2e7b3c GSEventRunModal + 75
18  UIKit                           0x21ec5a4e UIApplicationMain + 145
19  MyAwesomeApp                        0x000c1db4 main + 642484 (main.m:14)
20  libdyld.dylib                   0x1c32a4e6 _dyld_process_info_notify_release + 25

I am using the latest sample code mentioned on the official Facebook developer site.

#import <FBAudienceNetwork/FBAudienceNetwork.h>

@interface SearchViewController () <FBNativeAdDelegate>

@property (strong, nonatomic) FBNativeAd *nativeAd;
@property (strong, nonatomic) FBNativeAdView *fbNativeAdView;

@end

@implementation SearchViewController

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    FBNativeAd *nativeAd = [[FBNativeAd alloc] initWithPlacementID:@"2222222222222222_2222222222222222"];
    nativeAd.delegate = self;
    [nativeAd loadAd];
}

- (void)nativeAdDidLoad:(FBNativeAd *)nativeAd
{
    self.nativeAd = nativeAd;

    if (self.nativeAd && self.nativeAd.isAdValid) {

        FBNativeAdView *adView;
        adView = [FBNativeAdView nativeAdViewWithNativeAd:self.nativeAd
                                                 withType:FBNativeAdViewTypeGenericHeight300];

        if (self.fbNativeAdView && self.fbNativeAdView.superview) {

            [self.fbNativeAdView removeFromSuperview];
        }

        self.fbNativeAdView = adView;

        if (self.fbNativeAdView) {
        [self adjustNativeAdPlacement];
    }

        [self.collectionView addSubview:adView];
    }
}

- (void)nativeAd:(FBNativeAd *)nativeAd didFailWithError:(NSError *)error
{
    NSLog(@"Ad failed to load with error: %@", error);
}

@end

Please anyone help me in figuring out the issue?

Shasir
  • 21
  • 3

0 Answers0