Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8530971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:22:38+00:00 2026-06-11T09:22:38+00:00

I have an app that has three views. All three views have an Ad

  • 0

I have an app that has three views. All three views have an Ad Banner at the bottom of the screen. The first view creates an audio streamer which is paused when the Ad Banner on this view is clicked. I’m trying to use the AdBanner delegate methods on the second view to stop/start the audio. When the Ad Banner is selected the AdBanner delegate methods should call my custom delegate functions. The code compiles and runs but doesn’t function correctly.

Using NSLog I’ve determined that the Ad Banner is calling its delegate function correctly but this isn’t calling the custom delegate.

Hope this makes sense. Any help would be appreciated. Here is my code.

SecondViewControler H-file

#import "SecondViewController.h"

@protocol demoViewControllerDelegate <NSObject>
@required

-(void)stopSent;
-(void)startSent;

@end

@interface SecondViewController ()
{    
    id<demoViewControllerDelegate> delegate;
}    
@property (nonatomic, assign) id<demoViewControllerDelegate> delegate;
@end

SecondViewController M-file

@implementation SecondViewController
@synthesize delegate;

Protocols

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
    [delegate stopSent];
    return YES;
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner{
[delegate startSent];
}

FirstViewController H-file

#import <QuartzCore/QuartzCore.h>
#import "iAd/iAd.h"
#import <MessageUI/MessageUI.h>
#import "AudioStreamer.h"
#import "Reachability.h"
#import "SecondViewController.h"
#import "MFAppDelegate.h"
#import "MFSideMenu.h"

Class secondViewConroller;

@interface DemoViewController : UIViewController <ADBannerViewDelegate,demoViewControllerDelegate> {
}

@end

FirstViewController M-file

-(void)stopSent{
    if (isPlaying) {
        [streamer stop];
        wasPlaying=true;
    }
}

-(void)startSent{
    if (wasPlaying) {
        [streamer start];
         isPlaying=true;
    }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:22:40+00:00Added an answer on June 11, 2026 at 9:22 am

    Your protocol methods need to be implemented in the class that you’ve designated as your delegate target.

    It looks like your DemoViewController (or FirstViewController) is the object you’ve designated as the delegate, since you’ve given the interface the “<ADBannerViewDelegate,demoViewControllerDelegate>” designations.

    Then, from your Second View Controller, you can call the object you designated and set as a delegate by doing:

    [delegate startSent];
    

    and

    [delegate stopSent];
    

    in the appropriate locations, which appear to be “bannerViewActionShouldBegin” and “bannerViewActionDidFinish“, respectively.

    You should also make sure that the delegate is properly set, therefore instead of:

    [delegate startSent];
    

    you should actually do this:

    if(delegate)
        [delegate startSent];
    else
        NSLog( @"delegate is null; we should figure out why" );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that has a centre view with two views off to
I have a universal iOS app with a custom view that has three buttons,
I have an app that has a tabbar at the bottom. When I select
I have an app that populates list views when a view is created. I
I have an app that has a viewflipper to keep tabs in view at
I have an app that has a TableView, NavigationView and TabBar running together. There
Have an app that has listings - think classified ads - and each listing
I have an app that has different names for different languages. How do I
I have an app that has a list of items. My customer prefers to
i have an app that has a few checkboxes in the settings and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.