[Solved] Attempting a more-than if statement causes crash [closed]


I assume, that you have at least some knowledge of computer programming in some other language then Objective-C.

I will talk about this line, but the same problem occurs in several lines in your code

if(NSInteger >= 4)

You compare the type NSInteger with a number (4). I assume you want to compare a variable of the type NSInteger with the number 4!

Therefore your code would look something like this:

NSInteger mySavedNumber = 20;
if(mySavedNumber >= 4)

Ofc. ‘mySavedNumber’ is a name of the variable that I chose randomly and you should probably change it for something that makes sense for you, but I don’t know the rest of your code, I can’t really tell what you wanted to do. But you can’t name it NSInteger, since ‘NSInteger’ is a name that is already taken.

For the same reason I was talking about, this line of code also wont work:

NSInteger += 1;

Again, NSInteger is just a type and not a variable itself.

1

solved Attempting a more-than if statement causes crash [closed]