Before writing a piece about compiling Sdwebimage error Resolution article:
http://blog.csdn.net/cuibo1123/article/details/39434015
Results A lot of people ask the reason for this question, that is here to say to everyone said, the analysis of ideas together to send (but I still suggest you do the analysis).
First, if you create a new project, declare the output as Sdwebimage and quote:
- @interface zctest ()
- @property(Assign,nonatomic, Getter= isexecuting)BOOLexecuting;
- @property(Assign,nonatomic, Getter= isfinished)BOOLfinished;
- @end
-
- @implementation
- - (id
- {
- if (( Self = [SuperInit]))
- {
- _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, our own test code also inherit from nsoperation, You will find that the test code will then 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.
Original content, reproduced please specify the source: http://blog.csdn.net/cuibo1123
^^
XCODE6 compilation Sdwebimage error cause analysis (SDWEBIMAGEDOWNLOADEROPERATION.M errors)