My xcode version is 4.2.
When I use property to generate getter/setter methods.
Here is the code:
@interface NewSolutionViewController : UIViewController
@property(nonatomic, weak) NSString a;
There is no issue exist. However when I turn into basic data type
@interface NewSolutionViewController : UIViewController
@property(nonatomic, weak) int a;
My program crashed. Do you guys know the reason?
A basic data type is not an object, and hence does not need to be declared weak.
Use
to directly assign to the variable.