I want to pass a NSString
value to a class method of a NSObject class: +(void)loadTableData:(myCompletion) compblock;
. So I can only use a class variable NSString *categoryID
for use in the class method. I declare it in the .h file trying to let it also be used for public access. But I tried many ways, and can only declare it like below. Other positions will give me warning.
#import <Foundation/Foundation.h>
typedef void(^myCompletion)(NSArray *);
NSString *categoryID;
@interface ThirdVCLoadTable : NSObject
+ (void)loadTableData:(myCompletion) compblock;
@end
Then the problem is I am still not able to access it in my view controller class. The error message is always: Property "categoryID" not found on object of type "ThirdVCLoadTable", no matter what I try in order to access the NSString *categoryID
.
For example,
ThirdVCLoadTable *load = [[ThirdVCLoadTable alloc] init];
load.categoryID = [NSString stringWithFormat:@"%li", (long)indexPath.row + 1];