-7
-(IBAction)button:(id)sender{
  If (cardsinplay >= 16){
    NSNumber *cardValue = carsAndValue[14];
    NSInteger *Value = [cardValue integerValue[;

据我所知,这应该从数组中读取 NSNumber 并将其更改为 NSInteger 但我收到此错误。

Incompatible integer to pointer conversion initialization 'NSInteger*'(aka 'int*') with an expression of type 'NSInteger'(aka 'int*')
4

1 回答 1

4

-[NSNumber integerValue] returns a NSInteger, not a pointer to one.

NSInteger *Value = [cardValue integerValue];

should be

NSInteger value = [cardValue integerValue];
于 2013-07-11T13:26:19.887 回答