Xcode6 compiling Sdwebimage Error Resolution method (SDWEBIMAGEDOWNLOADEROPERATION.M errors)

Source: Internet
Author: User

Error:

Use of undeclared identifier ' _executing ';
Use of undeclared identifier ' _finished ';

Workaround:

In the implementation of the Sdwebimagedownloaderoperation class (@implementation sdwebimagedownloaderoperation{...} below) Add:

    1. @synthesize executing = _executing;
    2. @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)

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.