ios - Getting Error when trying to set a string equal to a part of an NSDictionary -
i'm trying set nsstring token json data when make post request. error i'm getting no visible @interface 'viewcontroller' declares selector 'appname'. i'm initializing userauthtoken in appdelegate acts global variable since want use userauthtoken in multiple classes.
line of code:
[[self appname] userauthtoken:jsondata[@"token"]]; method appname (it's in same file code above):
+ (appdelegate*)appname { return (appdelegate*) [[uiapplication sharedapplication] delegate]; }
here's in of projects now. create new file called "definitions.h"
in .pch file inside project:
#import "definitions.h" inside definitions.h
//definitions.h #define appdelegate() (appdelegate *)[[uiapplication sharedapplication]delegate] now, anywhere in code, can this:
appdelegate *del = appdelegate(); [del userauthtoken:jsondata[@"token"];
Comments
Post a Comment