gpt4 book ai didi

iphone - Objective-C 无法将 NSInteger 分配给 NSInteger 变量?

转载 作者:搜寻专家 更新时间:2023-10-30 19:50:57 24 4
gpt4 key购买 nike

这看起来是一个非常愚蠢的问题,但我不明白为什么会出现错误。

我有一个实例变量声明为:

NSInteger *scopeSelected;

我使用这个变量来跟踪在 UISearchDisplay Controller 中选择的范围,使用:

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller 
shouldReloadTableForSearchScope:(NSInteger)searchOption {
scopeSelected=searchOption;
return YES;
}

但是,我一直在分配行中收到此警告:

Assignment makes pointer from integer without a cast

有人可以告诉我我的代码有什么问题吗?不就是一个 NSInteger 到 NSInteger 的赋值吗?

最佳答案

NSInteger 是一个整数

改变:

NSInteger *scopeSelected;

到:

NSInteger scopeSelected;

关于iphone - Objective-C 无法将 NSInteger 分配给 NSInteger 变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3470041/

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