gpt4 book ai didi

ios - 将 int 转换为 *NSInteger

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:07:06 36 4
gpt4 key购买 nike

使用时

NSInteger *myInteger = 45 ; 

我收到警告消息 Incompatible Integer to pointer conversion sending 'NSInteger' (aka 'int') to parameter of type 'NSInteger *' (aka 'int *')我已阅读另一篇具有相同警告的帖子,但没有找到合适的解决方案。

最佳答案

NSInteger 不是 NSObject 的子类,它是一个原始类型。将您的代码更改为:

NSInteger a = 45 ; 

并且(当然)不要将变量命名为 int

关于ios - 将 int 转换为 *NSInteger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26460552/

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