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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:18:03+00:00 2026-05-25T03:18:03+00:00

I as a learning exercise of Objective C I need to write a method

  • 0

I as a learning exercise of Objective C I need to write a method that returns a Random NSObject.
The approach that I tried to follow was to trying to get a list of all runtime objects and the itirate through and get an NSObject and return that.

Firstly I am not sure if that is the best approach. Secondly the code I am using is based on this and objc_getClassList link but in Xcode4 I am getting compile time error

warning: Semantic Issue: Implicit declaration of function 'objc_getClassList' is invalid in C99
warning: Semantic Issue: Implicit declaration of function 'classIsSubclassOfClass' is invalid in C99

I have tried adding following headers but no good

#import <objc/runtime.h>
#import <objc/objc-class.h>
#import <objc/objc-runtime.h>

but neither helped me and still have the warning.

So can I please some help with these two things
1- Is this the right approach and what is if not to achieve what I am trying to achieve
2- How can I get this code to not give warnings in Xcode 4.

  • 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-25T03:18:05+00:00Added an answer on May 25, 2026 at 3:18 am

    Well, objc_getClassList is declared in objc/runtime.h, so including or importing that should do it.

    For the other part, you simply need to declare your function before you use it. At the top level of the file, or in a file that you then include, you put the function header, without the body:

    BOOL classIsSubclassOfClass( const Class aClass, const Class subclass );
    

    This lets the compiler know about the function; you can then #include this declaration in any file that needs to use the function, while defining it (i.e., filling out the body) wherever you like.

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

Sidebar

Related Questions

I'm brand new to MVC and, as a learning exercise, I'm trying to re-write
I'm trying (as a self-learning exercise) to create a Clojure macro that will generate
I've been trying to do something as a learning exercise that I thought should
Here's the scoop: As a learning exercise, I'm trying to write a Rails clone
I'm designing an application that supports plugin development. Its more of a learning exercise.
I'm trying to make a quick jquery plugin (as a learning exercise) for making
Im quite new to generics and as a learning exercise Im trying to create
I am working on a POSIX C learning exercise that involves recursively listing files/folders
I am new to Objective-C and as a very simple learning exercise, I have
As a learning exercise, I am creating a program that converts characters entered through

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.