Accessing Singleton Instance Variable in Class Methods Throws Warning?
Posted
by Ross
on Stack Overflow
See other posts from Stack Overflow
or by Ross
Published on 2010-06-16T16:39:58Z
Indexed on
2010/06/16
16:42 UTC
Read the original article
Hit count: 406
objective-c
Hello,
I've using the Objective-C singleton from here at stackoverflow.
The singleton in the class method accesses it's instance variable, which works, but throws a complie warning. How should I be doing this? Is there a way to do this without accessing the sharedInstance:
in each class method?
for example here is my class method:
+ (NSString *)myClassMethods {
[instanceDateFormatter setFormat:@"MM"];
return [instanceDateFormatter stringWithDate:somedate];
}
line 2 will have the complie warning.
Thanks, Ross
© Stack Overflow or respective owner