ios - Call a static var in another class , in objective c -


I try to get a static variable from a class so I log in to this file.

  + (instancetype) Set token: (NSString *) aToken;  

Login to the file. I do this

  Fixed NSString * token; ....... + (instancetype) setToken: (NSString *) A token {token = [aoken copy]; Returned a token; }  

So I can get the price

  [login set token: token]  

but I do not know How to get this value in the second category

Create a great method for it > Fixed will return the variable value

Add a signature to the Login.h file of that method.

  + (NSString *) getUniqueToken;   

Login. M relevant method in class.

  + (NSString *) getUniqueToken {return token; }  

Because it is a class method, you can log in hardly with creating long class objects.

Call above method in another controller class, this token string.

[look like];

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -