dpigera
dpigera

Reputation: 3369

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

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?

Upvotes: 3

Views: 5833

Answers (1)

falconcreek
falconcreek

Reputation: 4170

NSInteger is an int

change:

NSInteger *scopeSelected;

to:

NSInteger scopeSelected;

Upvotes: 18

Related Questions