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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:54:00+00:00 2026-06-03T16:54:00+00:00

My code has a class in it (let’s call it myRefLib) that inherits from

  • 0

My code has a class in it (let’s call it myRefLib) that inherits from UIReferenceLibraryViewController (part of UIKit Framework) which is a class that is only available in iOS 5 and above. I would like to have a deployment target of iOS 3.2.

If i was just creating an instance of the UIReferenceLibraryViewController, I understand I can use a base SDK of 5 and then test if the class exists with [UIReferenceLibraryViewController class] before running any code that includes it. But how do I do it if I’m inheriting from the class?

The issue is that I have to #include the inheriting class myRefLib for the parts of my code that will use it – but there is no way to conditionally do that at runtime. Alternatively there is also no way of runtime conditionally inheriting from UIReferenceLibraryViewController in myRefLib. I’d also like to make an instance of myRefLib a property of another class – again, how can I do that runtime conditionally?

Any help much appreciated …

D

  • 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-03T16:54:01+00:00Added an answer on June 3, 2026 at 4:54 pm

    Well, first of all, you have know what you’re going to do when running on the earlier OS. Basically, you have to write your code as though you were building against the iOS 3.2 SDK. Only then can you add optional enhancements using the newer features.

    Starting with the easiest thing: you don’t need a declaration of a class interface in order to declare variables, including instance variables, as pointers to that class. You just need a forward declaration:

    @class SomeClass;
    SomeClass* foo;
    

    Next, there should be no problem with importing a header which defines your class. That’s a compile-time thing, which you seem to think is a problem, but which means it’s not affected by the runtime environment. It will compile because you’re building against the iOS 5.0 SDK.

    The thing you have to be careful of is to not use the class if it’s not available. You already know how to check that: test if [SomeClass class] returns Nil. If it does, don’t instantiate your custom subclass.

    Finally, you mention “runtime conditionally inheriting from UIReferenceLibraryViewController in myRefLib”. Why do you think you need to do that? If UIReferenceLibraryViewController is not available, then it doesn’t make much sense to want to use myRefLib which subclasses it. If you have some alternative implementation in mind that doesn’t depend on UIReferenceLibraryViewController, then make a separate class. Then conditionally pick between myRefLib and this other class depending on availability.

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

Sidebar

Related Questions

Let's say I have a base class Animal from which a class Cow inherits,
Class 1 has the following code that generates the exception - -(IBAction) searchAllAction: (id)
I have the following code which has a mutable Person class, String and a
I wrote a class (let's call it Model.java) that contains a Deque<T> , with
Let's say one has a class that performs a certain type of task. And
I am debugging some C# class (let's say, Foo) which has a Dispose-Finalize pattern
The code has a runtime dependency which is not available in our development environment
I have a class that contains a member object. I would like to call
First let me show some code. class User has_and_belongs_to_many :roles named_scope :employees, { :conditions
In my C# class project, I have a helper class which has the following

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.