Error: expected property attribute before atomic

I get the following exception on this line:

@property (atomic ,retain) NSString *title;

error: expected a property attribute before 'atomic'

What does it mean?

+3
source share
1 answer

The declared property does not use an atomic word. A declared property behaves "atomically" by default, so you do not need to set it explicitly. You simply change the default behavior by adding a non-atomic. Since this is a compile-time directive, there is no need to change this value at run time, making it "atomic" unnecessary.

Quote Apple Objective-C Programming Language / Declared Properties

Atomicity

. ( .)

nonatomic , . . , , , , , . . " ".

+8

All Articles