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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:12:20+00:00 2026-05-15T02:12:20+00:00

I am building my first iPhone/Obj-c app and I have a large amount of

  • 0

I am building my first iPhone/Obj-c app and I have a large amount of data-holding subclasses that I am passing into a cite function. To the cite function these objects are anonymous and I need to find a way to access all the variables of each passed object.
I have been using a pre-built NSArray and Selectors to do this but with more than 30 entries (and growing) it is kind of silly to do manually. There has to be a way to dynamically look up all the variables of an anonymous object.

The obj-c runtime run-time docs mention this problem but from what I can tell this is not available in iPhone OS. If it is then I don’t understand the implementation and need some guidance. A similar question was asked before but again I think they were talking about OSX and not iPhone.

Any thoughts?

-(NSString*)cite:(id)source {
 NSString *sourceClass = NSStringFromClass([source class]);

 // Runs through all the variables in the manually built methodList
 for(id method in methodList) {
  SEL x = NSSelectorFromString(method);
  // further implementation

 // Should be something like
 NSArray *methodList = [[NSArray alloc] initWithObjects:[source getVariableList]]
 for(id method in methodList) {
  SEL x = NSSelectorFromString(method);
  // Further implementation
 }
  • 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-15T02:12:21+00:00Added an answer on May 15, 2026 at 2:12 am

    The runtime is the same on the Mac as it is on the iPhone. If the other question does what you’re looking for, then it should work. If it doesn’t, file a bug.

    In the meantime, given a Class, you can retrieve a list of all of its selectors using the class_copyMethodList() function:

    unsigned int numMethods = 0;
    Method * methods = class_copyMethodList(sourceClass, &numMethods);
    NSMutableArray * selectors = [NSMutableArray array];
    for (int i = 0; i < numMethods; ++i) {
      SEL selector = method_getName(methods[i]);
      [selectors addObject:NSStringFromSelector(selector)];
    }
    free(methods);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an IPhone application (first one) that needs to send data to
I´m building an app for iphone. I have two views. The first time the
I'm building an iphone app, and i have my first view call a second
I am in the process of building my first iPhone app (xCode,objective-c) which has
I have received this message ever since I started building my first iPhone program
I just installed Xcode 3.2.3. I have a first generation iPhone that I use
I'm diving in to iPhone development and I'm building an iPhone app that uses
I am building an iPhone app that plays videos on demand from a web
I am building an iphone game. I have a set of NSStrings that I
I am building a core data iphone app, and having trouble with retrieving one-many

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.