The rules are slightly different between explicit ivar declarations and property declarations.
With an explicit instance variable declaration, strong ownership is assumed:
@interface Officer : NSObject
NSString *name; // I'm a strong pointer, because __strong is the default!
__strong NSString *rank; // I'm a strong pointer, also!
__weak NSString *superiorOfficer; // I'm a weak pointer~
With a property declaration, assign is the default storage specifier, and is the only storage specifier allowed for primitive types. Assign, however, is rarely what you want for an object pointer, so the compiler will require you to provide a storage specifier for object pointer properties (but not primitive properties). This is really just to protect you from accidentally accepting assign when you don’t mean to.
[code]// I’m all good, because I’m a primitive type, and I want to be assigned, which is the default.
@property (nonatomic) float height;
// Uh oh. The compiler’s not going to like this. Primitive types can only be assigned.
@property (strong, nonatomic) int age;
// The compiler won’t like this either, because I’m an object pointer, so I need an explicit storage specifier.
@property (nonatomic) NSString *name;
// Ah, much better. I just need to make sure my specifier matches my ivar declaration’s.
@property (strong, nonatomic) NSString *rank;
// assign is okay, if that’s really what I want. I just have to be clear about it.
@property (assign, nonatomic) NSString *favoriteColor;[/code]