python scrapy Explanation

2022-12-27   ES  

Strong and Weak are newly introduced object variable attribute attributes Xcode 4.2 (iOS SDK4.3 and the following versions) and the previous versions use Retain and Assign, which do not support ARC. Xcode 4.3 (iOS5 and above) have ARC and start using Strong and Weak.

Strong: Called strong reference, use Strong in ARC to tell the compiler to help us automatically insert Retain.

Weak: Called weak references. Weak in ARC is an ASSIGN that is equivalent to manually manually managing memory.

_UnSafe_unretAINED is consistent with the Weak function. The difference is that after the object of the direction is destroyed, the Weak will say that it will be changed to Nil to prevent calling the wild pointer.

Assign: For non -pointer variables, for basic data types (such as NSINTEGER) and C data types (INT, Float, Double, CHAR,, etc.), and also IDs such as:

@property (nonatomic, assign) int number; 

@property (nonatomic, assign) ID className; // ID must use assign

Anyway: If you don’t need to add “*”, use assign if you don’t need to add “*”

RETAIN: For pointer variables, that is, you define a variable, and then this variable will be changed during the running process of the program and affects other methods. Generally used for string (NSSTRING, NSMUTableString), array (NSARRAY), dictionary objects, view objects, controller objects, etc.

​@property (nonatomic,retain) NSString * myString; 

​@property (nonatomic, retain) UIView * myView;

 @property (nonatomic, retain) UIViewController * myViewController;​

xcode 4.2 does not support ARC, so it will frequently use RETAIN to modify and release it after use. Xcode4.3 supports ARC. You can use Retian without manual release of memory. The system will automatically complete it for you. If you are in XCode4. 3 Developed above, Retian and Strong are the same, there is no difference

Copy: Used to copy objects, general string uses COPY, unsatisfactory objects in Foundation use the COPY effect equivalent to Retain, but only reference counting +1.

Readonly This tag shows that the attribute is read only, and the default mark is read and write. If you specify you only, you only need a reader in @implementation. Or if you use the @Synthesize keyword, it is also analyzed by the reader method. And if you try to assign a dot operator to the attribute, you will get a compilation error.

ReadWrite This mark indicates that the attribute will be regarded as read and write, which is also the default attribute. Both the setter and the reader need to be implemented in @implementation. If the @Synthesize keyword is used, the reader and the setter will be parsed.

Assign This mark The setting device is directly assigned, which is also the default value. In applications collected by garbage, if you want a attribute to use Assign and this class meets the NScopying protocol, you must clearly point out this mark instead of simply using the default value. Otherwise, you will get a compilation warning. This once again explained to the compiler you really need to be assigned, even if it is copied.

RETAIN specify that Retain will wake up the transmitted Retain message when assigning. This attribute can only be used for Objective-C object type, not for the Core Foundation object. (The reason is obvious, Retain will increase the reference count of the object, and none of the basic data types or Core Foundation objects are not cited -translator’s note).

Copy pointed out that a copy of the transmission value when assigning is assigned. The copy work is executed by the Copy method. This attribute is only valid for those object types that implement the NSCOPying protocol.

Nonatomic pointed out that the accessor is not an atomic operation, but the default, the accessor is atomic operation. That is to say, in a multi -threaded environment, the interviewer provides a security access to attributes. The return value obtained from the obtained device or the value set by the setter can be completed at one time. Even other threads are facing it. Access. If you do not specify Nonatomic, in the environment you manages the memory, the parsing access device retains and automatically releases the returned value. If the Nonatomic is specified, the accessor simply returns this value simply.

So the attribute of Property is: ReadWrite, Assign, Atomic (without this keyword


Related Posts

JDBC use The use of

[BZOJ1047] [Monocele] [haoi2007] ideal square

Spring Boot series Spring @Value attribute injection and use summary

From entry to the soil: [SEED-LAB] MD5 collision test | MD5Collgen Experiment | Linux | Ubuntu | MD5 COLLISION Attack Lab | Detailed explanation

python scrapy Explanation

Random Posts

Find the neutral neutral and the combination IT for the given number

SDUT minimum intercept system Guojing

1 1 1 1 1 1 1 1 1 1 overall review

Thinkcmf any file to write vulnerabilities —- Learning records

LINUX offline installation TensorFlow-GPU-2.0.0