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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:45:49+00:00 2026-05-15T10:45:49+00:00

well to begin with I’m sure this is a simple question. I am developing

  • 0

well to begin with I’m sure this is a simple question.

I am developing an iPhone app with the iAd Framework, which only runs for iOS 4.0 or higher.

Still, I wanna choose a iPhone OS 3.0 deployment target, which causes everything to crash.

  • How do I conditionally include the iAd framework?
    …I mean, it would be something like:
    …if([[UIDevice currentDevice] systemVersion]>=4.0]) #import

Obviously this won’t work because I don’t know the correct syntax. Also:

  • How do I conditionally declare an AdView* variable?
  • How do I conditionally handle this AdView* variable in my implementation file.

If you guys could help me, I will be very well impressed.

Thanks

  • 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-05-15T10:45:49+00:00Added an answer on May 15, 2026 at 10:45 am

    You don’t need to change your include, you need to make the iAd (or any other new framework) linked weakly:

    In your target, find iAd in the linked frameworks and change its “Role” from “Required” to “Weak”.

    To handle the variable conditionally, use NSClassFromString function, like this:

    Class AdClass = NSClassFromString(@"ADBannerView");
    if(AdClass) {//if the class exists
        ADBannerView* myAd = [[AdClass alloc] initWithFrame:CGRectZero];
        // do something with the ad
    }
    

    If OS is older than iOS 4.0, AdClass will be nil and the code won’t execute. Note that using ADBannerView* as the type of the variable shouldn’t cause any problems, as it’s just a hint for a compiler and is the same as id after compilation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well to begin i would like to mention that the aim of this question
I am matching words that begin with certain prefixes. This regex is working well
Let me begin by stating that this is a question of aesthetics. I've solved
To begin with, let me apologise for asking yet another question referring this topic.
Well, this is my first foray into memory profiling a .NET app (CPU tuning
To begin with, this is the first Android app I'm writing, and I have
I have a multi-threaded application which scales well to begin with, but running on
I would like to begin work on an iPhone app that does little more
I have this predicate which works somewhat well. NSPredicate *filter = [NSPredicate predicateWithFormat:@code contains[cd]
Well, this is not at all an optimization question. I am writing a (for

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.