Reputation: 1198
if (([gameplay1.text intValue] % [gameplay3.text intValue]) == 0)
{
//Do something
}
Can someone please help me out with this?
Upvotes: 0
Views: 3251
Reputation: 11
it because you can't divide by zero
you can add some code like
if(![gameplay3.text intValue]){
gameplay3.text = "1";
}
before your if judgement
it should be work and not affect your results :)
Upvotes: 1
Reputation:
You have provided almost no information, but it seems to me that
[gameplay3.text intValue]
returns 0. You can't divide by zero, hence the error.
Upvotes: 7
Reputation: 3710
There are a few things that can cause this, the most likely of which being that you are trying to divide by 0. What is the value of [gameplay3.text intValue]
when this occurs?
Upvotes: 2