How can I access instance variable in class method in Objective-C?

objective-c

Solution

You can't access instance variables from class methods. As instance variables are bound to certain instances of a class, accessing them from a class method doesn't make sense, thus the language doesn't permit it.

Problem

I am developing an application in which I implement a class method.h How can I access an instance variable in a class method? Here is my instance method and an object is created of the class 'SomeClass': ``` -(void)viewDidLoad { SomeClass *obj=[SomeClass alloc] init]; } ``` Here is the class method and in this method I am trying to access instance variable 'obj', so I got an error saying "instance variable 'obj' accessing in class method". ``` +(void)classMethodImplement { } ```

Original source