XCODE6 compilation Sdwebimage error cause analysis (SDWEBIMAGEDOWNLOADEROPERATION.M errors)

Source: Internet
Author: User
Tags vars

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:

  1. @interface zctest ()
  2. @property(Assign,nonatomic, Getter= isexecuting)BOOLexecuting;
  3. @property(Assign,nonatomic, Getter= isfinished)BOOLfinished;
  4. @end   
  5.   
  6. @implementation
  7. -  (id
  8. {
  9. if (( Self = [SuperInit]))  
  10. {
  11.          _executing = no ;  
  12.          _finished = no ;  
  13.      }  
  14.      return self ;  
  15. }  
  16. @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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.