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 7833779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:53:40+00:00 2026-06-02T12:53:40+00:00

I am trying to isolate iAd initialization code from the main UIViewController as much

  • 0

I am trying to isolate iAd initialization code from the main UIViewController as much as possible to achieve an easy integration for my apps in the future. I created AdManager (NSObject) class to deal with iAd setup and initialization. However, I do not know how to set up delegates for objects outside UIViewController which implements these delegate classes. For example:

@interface AppViewController : UIViewController<ADBannerViewDelegate>

and my AdManager would have something like this:

+(void)initAdBannersInView:(UIView*)view andViewController:(UIViewController*)vc{
  ADBannerView *iAdBannerView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, -bannerSize.height, bannerSize.width, bannerSize.height)];
  iAdBannerView.delegate = vc;  
  [view addSubview:iAdBannerView];

Error (warning) message is: Assigning to ‘id’ from incompatible type ‘UIViewController’

I may not be very good with this particular situation about delegates, so pardon my possible misunderstanding but is it possible to achive what I need in a similar way? How?

  • 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-02T12:53:42+00:00Added an answer on June 2, 2026 at 12:53 pm

    You are defining the vc argument as UIViewController *. That means you can pass any old view controller in there, not necessarily one that conforms to the ADBannerViewDelegate protocol. You should define the vc argument so that you can only pass view controllers that conform to that protocol in:

    +(void)initAdBannersInView:(UIView*)view andViewController:(UIViewController<ADBannerViewDelegate>*)vc{
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to isolate all the server names (i.e sv012-cali) from within an html
I am trying to isolate my HTML from my js by replacing the following
I'm trying to isolate a specific field in a SQL dump file so I
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
Trying to determine if it is possible to bind the SelectedValue of a ComboBox
I'm trying to isolate duplicates in a 500MB database and have tried two ways
I have simplified an issue that I've been having trying to isolate the problem,
I'm trying to understand the documentation from Android for Sensor.TYPE_ACCELEROMETER: It gives this example:
I am trying to produce a proof of concept shipping logging from Log4J through
I am trying to isolate the source of a memory leak in my C#

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.