Error:
Use of undeclared identifier ' _executing ';
Use of undeclared identifier ' _finished ';
Workaround:
In the implementation of the Sdwebimagedownloaderoperation class (@implementation sdwebimagedownloaderoperation{...} below) Add:
- @synthesize executing = _executing;
- @synthesize finished = _finished;
Can.
Original content, reproduced please specify the source: http://blog.csdn.net/cuibo1123
cause of the problem (2014.11.29 supplement):=================================================================
(The following is time-consuming and laborious, reprinted annotated http://blog.csdn.net/cuibo1123)
See a lot of people ask the reason for this question, that is here to say to everyone said a good, analytical thinking together to send (but I still suggest that you do their own analysis).
First, if you create a new project, declare the output as Sdwebimage and quote:
@interface Zctest ()
@property (Assign, nonatomic, getter = isexecuting) BOOL executing;
@property (Assign, nonatomic, getter = isfinished) BOOL finished;
@end
@implementation Zctest
-(ID) init
{
if (self = [super init])
{
_executing = NO;
_finished = NO;
}
return self;
}
@end
This code does not have any problems and can be compiled properly.
So why does the same code have the following hint in Sdwebimage?
Use of undeclared identifier ' _executing ';
Use of undeclared identifier ' _finished ';
The idea is to find Sdwebimage's sdwebimagedownloaderoperation class and their own code is different. It is easy to see that Sdwebimagedownloaderoperation inherits the parent class is nsoperation, then, we also inherit our own test code from Nsoperation, you will find that the test code will report the same error. Well, the reason for locating in nsoperation, look at this interface, open NSOperation.h, in the declaration will find the following two lines:
@property (readonly, getter=isexecuting) BOOL executing;
@property (readonly, getter=isfinished) BOOL finished;
Okay, here's the problem. Nsoperation declares two attributes of the same name and is ReadOnly, so using _executing = No in sdwebimagedownloaderoperation will prompt an error. The use of assign precedence in sdwebimagedownloaderoperation extensions is lower than inherited (guessing). This is the origin of the problem.
As for the old version of Xcode why not error, this may be attributed to Xcode itself, perhaps the old version of the ReadOnly mode will also produce _executing, but xcode6 in the readonly mode to optimize the _executing variable, Interested in self-test or to see the compilation process files. There is no further reading.
Xcode6 compiling Sdwebimage Error Resolution method (SDWEBIMAGEDOWNLOADEROPERATION.M errors)