I get the following exception on this line:
@property (atomic ,retain) NSString *title;
error: expected a property at开发者_JAVA技巧tribute before 'atomic'
What does that mean ?
There is no keyword atomic to use in a declared property. A property declared is by default behaving "atomic" so you don't have to set it explicitely. You just change the default behaviour by adding nonatomic. As this is a compile time directive it is not needed to change this value during runtime, making "atomic" needless.
Quoting Apple's The Objective-C Programming Language / Declared Properties
Atomicity
You can use this attribute to specify that accessor methods are not atomic. (There is no keyword to denote atomic.)
nonatomic Specifies that accessors are nonatomic. By default, accessors are atomic. Properties are atomic by default so that synthesized accessors provide robust access to properties in a multithreaded environment—that is, the value returned from the getter or set via the setter is always fully retrieved or set regardless of what other threads are executing concurrently. For more details, see “Performance and Threading.”
精彩评论