3

这似乎是一个非常愚蠢的问题,但我不知道为什么会出错。

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

NSInteger *scopeSelected;

我使用这个变量来跟踪 UISearchDisplay 控制器中选择的范围,使用:

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

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

赋值使指针从整数而不进行强制转换

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

4

1 回答 1

18

NSInteger是一个整数

改变:

NSInteger *scopeSelected;

到:

NSInteger scopeSelected;
于 2010-08-12T16:53:38.930 回答