Semantic Issue: Instance variable '_delegate' accessed in class method

134 views
Skip to first unread message

Fliperamma

unread,
Oct 8, 2013, 9:49:12 AM10/8/13
to appi...@googlegroups.com
Hi! I'm not a Objective-C dev (I'm not a very experienced dev at all) and I'm trying to implement Appirater in my Unity game but when I try to compile in XCode I'm getting this error:


I have XCode Version 5.0 (5A1413)

The lines with the error are:

"Semantic Issue: Instance variable '_delegate' accessed in class method"

+ (void)setDelegate:(id<AppiraterDelegate>)delegate{

 _delegate = delegate;

}




+ (Appirater*)sharedInstance {
 
static Appirater *appirater = nil;
 
if (appirater == nil)
 
{
       
static dispatch_once_t onceToken;

        dispatch_once
(&onceToken, ^{

            appirater
= [[Appirater alloc] init];

            appirater.delegate = _delegate;

           
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive) name:

               
UIApplicationWillResignActiveNotification object:nil];
       
});
 
}
 
return appirater;
}


Thanks for your time


Фоминых Егор

unread,
Mar 7, 2014, 10:29:51 AM3/7/14
to appi...@googlegroups.com
Compiler thinks that _delegate is an instance variable because there is property delegate in Appirater class.  Just replace all _delegate to __delegate (or something else) in Appirater.m. This works fine for me.

вторник, 8 октября 2013 г., 17:49:12 UTC+4 пользователь Fliperamma написал:
Reply all
Reply to author
Forward
0 new messages