开发者

Objective-C can't assign a NSInteger to an NSInteger variable?

开发者 https://www.devze.com 2023-01-11 20:52 出处:网络
This is going开发者_开发百科 to seem like a really silly question but I can\'t figure out why I\'m getting an error.

This is going开发者_开发百科 to seem like a really silly question but I can't figure out why I'm getting an error.

I have an instance variable declared as:

NSInteger *scopeSelected;

I'm using this variable to keep track of what scope has been selected in a UISearchDisplay controller using:

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

However, I keep getting thrown this warning at the assignment line:

Assignment makes pointer from integer without a cast

Can someone please tell me what is wrong with my code? Isn't it just an NSInteger to NSInteger assignment?


NSInteger is an int

change:

NSInteger *scopeSelected;

to:

NSInteger scopeSelected;
0

精彩评论

暂无评论...
验证码 换一张
取 消