Bad Receiver type 'NSInteger' (aka 'int')

11,383

Solution 1

int thumbCount = [self thumbsViewNumberOfThumbs:_totalThumbs];

Solution 2

The compiler is right: NSInteger is not a type that could possibly have methods, because it is not an id-derived type.

If you have a method that takes NSInteger as parameter, you pass it after the colon :, not as the receiver of the method.

Share:
11,383
icodes
Author by

icodes

Updated on June 26, 2022

Comments

  • icodes
    icodes about 2 years
    int thumbCount = [_totalThumbs thumbsViewNumberOfThumbs:self];
    
    1. _totalThumbs is a NSInteger type property.
    2. thumbsViewNumberOfThumbs is a method of type NSInteger.

    I need to get the count in 'int' itself so that i can use it for further calculations. Any suggestions?