gpt4 book ai didi

objective-c - Objective C 定义属性的问题

转载 作者:行者123 更新时间:2023-12-03 07:03:14 26 4
gpt4 key购买 nike

当我尝试将 int 定义为 Objective C 中的属性时,出现错误(不是对象类型)。我尝试过使用 NSInteger 和 int 但都不起作用。

代码: int座位;

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

最佳答案

您不能保留 int 或 NSInteger,因为它们是原始类型 - 不是对象。请改用以下内容:

@property (nonatomic, assign) int seats;

关于objective-c - Objective C 定义属性的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1038990/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com