Search code examples
iosxcodeadsleadbolt

Expected Identifier Error when implementing leadbolt ads


I am currently implementing LeadBolt interstitial ads into my iOS app. However, at the end of this line:

[[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleModuleFail) name:@"onModuleFailed" object:@"AppFireworksNotification"]];

I am getting an "expected identifier" error. Please advise on how this can be resolved.

-(void)loadDisplayAd
{
   LeadboltOverlay *interstitial = [LeadboltOverlay createAdWithSectionid:@"YOUR_LB_INTERSTITIAL_ID" view:self.view];
   [interstitial loadAd];
}


- (void)viewDidLoad {

    LeadboltOverlay *audioad = [LeadboltOverlay createAdWithSectionid:@"YOUR_LB_AUDIO_ID" view:self.view];
    [audioad loadAudioAd];
    // [AppTracker setLandscapeMode:YES]; // Un-comment for Landscape mode
    [[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleModuleFail) name:@"onModuleFailed" object:@"AppFireworksNotification"]];
    [AppTracker startSession:@"APPFIREWORKS_API_KEY" view:self.view];


    [self loadDisplayAd];

Solution

  • You have an extra set of brackets. Replace this:

    [[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleModuleFail) name:@"onModuleFailed" object:@"AppFireworksNotification"]];
    

    With this:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleModuleFail) name:@"onModuleFailed" object:@"AppFireworksNotification"];