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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:06:56+00:00 2026-06-08T16:06:56+00:00

I have an interesting problem where I am trying to call class methods on

  • 0

I have an interesting problem where I am trying to call class methods on an class which I essentially know nothing about in my test method. I can inspect its inheritance and any protocols it may implement but can’t see an easy way to just call a method on it without getting tied up with an NSInvocation. The code below, albeit crudely, tries to demonstrate the problem I am having.

@interface ClassA : NSObject

+ (Class)classIsPartialClassOf;

@end

@implementation ClassA

+ (Class)classIsPartialClassOf {
    return [NSString class];
}

@end

@interface ClassB : NSObject

@end

@implementation ClassB

- (id)init {

    [ClassB testClass:[ClassA class]];

}

+ (void)testClass:(Class)classDecl {

    /* obviously if you know the type you can just call the method */
    [ClassA classIsPartialClassOf];

    /* but in my instance I do not know the type, obviously there are no classmethods to perform selector such as the fictional one below */
    [classDecl performSelector:@selector(classIsPartialClassOf)];

}

@end

Methods for getting implementations seem to return instance variants and I can’t get them to fire on the static class itself.

Are my options limited to invocations or have I missed something obvious and should kick myself?

Thank you in advance for your help.

  • 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-08T16:06:58+00:00Added an answer on June 8, 2026 at 4:06 pm

    “Methods for getting implementations seem to return instance variants and I can’t get them to fire on the static class itself.”

    Then use objc_getMetaClass("ClassName") instead of objc_getClass. Class objects are objects themselves and are instances of their metaclass. If you pass the metaclass object to e. g. class_getMethod(), everything will be fine.

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

Sidebar

Related Questions

I have an interesting problem here I've been trying to solve for the last
As part of my ecommerce application, I have this interesting problem, I've been trying
I have an interesting problem, which is a function that returns a Dictionary<String,HashSet<String>> .
I have an interesting problem trying to represent complex schedule data in a database.
I have run into a very interesting problem trying to debug my custom PHP
I have an interesting (at least to me) problem: I can't manage to find
I have an interesting problem which I've been looking into and would appreciate some
I have an interesting problem that I'm trying to solve and was wondering if
I have a interesting problem with position: fixed in Opera Mobile 11: Test page:
We have an interesting problem with WCF binding and streaming transfer mode that we

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.