Objective-C不能将NSInteger分配给NSInteger变量?

时间:2010-08-12 16:49:55

标签: iphone objective-c nsinteger

这似乎是一个非常愚蠢的问题,但我无法弄清楚为什么我会收到错误。

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

NSInteger *scopeSelected;

我正在使用此变量来跟踪使用以下内容在UISearchDisplay控制器中选择的范围:

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

但是,我一直在分配线上抛出这个警告:

  

赋值使整数指针   没有演员

有人可以告诉我我的代码有什么问题吗?它不仅仅是NSInteger分配的NSInteger吗?

1 个答案:

答案 0 :(得分:18)

NSInteger是一个int

变化:

NSInteger *scopeSelected;

为:

NSInteger scopeSelected;
相关问题