New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
iOS Development Discussion on developing apps for the iOS platform.

What does nonatomic and retain do in Objective-C?

Post Reply New Thread Subscribe

Thread Tools

Member Since: Feb 21, 2011
Posts: 22
prateek.chaubey is on a distinguished road
Mac Specs: Macbook Air 11", 64 GB, Intel core i5, 1.6 GHz, OSX Lion 10.7

prateek.chaubey is offline
Hello every1

In objective-c when we apply synthesize accessor method or when we write property, we also use 2 terms, they are: nonatomic and retain. the syntax is given below:

@property(nonatomic, retain)

I would like to know what exactly nonatomic and retain do.
Please guide
reply soon..

QUOTE Thanks

xstep's Avatar
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
Both are discussed here in The Objective-C Programming Language. Search that document for those two words.

In short...

The nonatomic directive means no locking of the variable is done during access. This speeds up access. In a multithreading scenario that could be a bad thing.

The retain directive means that upon assignment, the object will be retained. If you override the properties setter method, I believe you are then responsible for the retain.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks

Post Reply New Thread Subscribe

« Deploy iPhone app without developer account | Which Xcode version to download?? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 03:58 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?