Objective C问题定义属性

2 objective-c

当我尝试在目标C中将int定义为属性时,我得到一个错误(不是对象类型).我尝试过使用NSInteger和int,但都没有工作.

代码:int seat;

@property(非原子,保留)int席位;

tea*_*bot 11

您不能保留int或NSInteger,因为它们是基本类型 - 而不是对象.请改用以下内容:

@property (nonatomic, assign) int seats;
Run Code Online (Sandbox Code Playgroud)