StyxS
StyxS

Reputation: 3

how can I call class method by using objc_class variable

@interface SomeClass
- (void)funcA;
+ (void)funcB;
@end

@interface Test
@property(nonatomic, assign) Class aClass;
@end

@implementation Test
- (void) test {
    // that's ok
    [[aClass new] funcA];
    // but how to call class method?
    [aClass funcB] ?
}
@end

XCode note "Instance method 'function' is being used on 'Class' which is not in the root class"

Upvotes: 0

Views: 61

Answers (2)

Kamil.S
Kamil.S

Reputation: 5543

[((id)aClass) funcB];

or similarly to @Pancho's answer

[[aClass class] funcB];

Upvotes: 1

Pancho
Pancho

Reputation: 4143

Have you tried ?

[[aClass class] performSelector:@selector(funcB)];

Upvotes: 3

Related Questions