Reputation: 39
I guess it's really simple but I can't find the way to work this out...
I have a method like this
- (int)showQuestionMethod:(int)number;
I'm creating NSMutableOrderedSet in loop like this which works fine.
while (count < numberOfQuestionsInTest) {
randomQuestionNumber = 0 + arc4random() % (numberOfQuestions - 0);
[_randomQuestionNumberArray addObject:[NSDecimalNumber numberWithInt:randomQuestionNumber]];
count = [_randomQuestionNumberArray count];
}
Then when I want to call a method with this line and I get an error (Incompatible pointer to integer conversion sending 'id' to parameter of type 'int')
int showQuestion = 0;
[self showQuestionMethod:_randomQuestionNumberArray[showQuestion]];
Can anyone offer solution? Thank you!
Upvotes: 1
Views: 4461
Reputation: 318934
Your _randomQuestionNumberArray
contains NSDecimalNumber
instances. But your method takes and int
parameter. You need to properly convert them:
[self showQuestionMethod:[_randomQuestionNumberArray[showQuestion] intValue]];
Upvotes: 4