Why (nonatomic) instead of (nonatomic, strong)


#1

In BNRCoursesViewController.m there is the following line:

@property (nonatomic) NSURLSession *session;

Why is it not

@property (nonatomic, strong) NSURLSession *session:

NSURLSession is a class, why do we not have a strong reference to it?


#2

Is there any answer to this? I was wondering the same thing.

*EDIT: Just noticed this question was posted only today. Rephrase: I was wondering the same thing, but hoping for some responses soon :wink:


#3

There are some inconsistencies in the book with this, so I apologize for that, but let me help clarify here.

For objects, strong is the default. So the two lines of code you mentioned are identical:

@property (nonatomic) NSURLSession *session;
// is the same as
@property (nonatomic, strong) NSURLSession *session:

For primitives, assign is the default, so:

@property (nonatomic) int value;
// is the same as
@property (nonatomic, assign) int value;

Hope that helps!


#4

That clears everything up.

Thank you for your prompt and informative reply.
:smiley: