if-else length crash?

Hi,


I am currently experiencing a rather strange error. You see, I have a very big chunk of if-else-code, and suddenly to one specific line - it just crashes when I add another one. It's worth mentioning that this if-else code is rather big (many hundreds), and it's nothing wrong with it. It's just that it crashes when I try to add another line. Is this a common error, and is it a way to fix this? I am checking two values to prompt a specific message. If it's another way to check big amount of data (2 textbox-texts, and display/hide a textbox - I would be very happy if you could tell me how :-)


Thanks in advance.

Answered by KMT in 98481022

Hundreds...ouch.


Instead of 'if/else', you might want to change to switch statements. From the docs:


"A switch statement considers a value and compares it against several possible matching patterns. It then executes an appropriate block of code, based on the first pattern that matches successfully. A switch statement provides an alternative to the if statement for responding to multiple potential states."


In any case, regardless of how many ifs you have, it's typically a fumbled fingered entry hiding in the ranks that suddenly knocks the cup to the floor. Confirm your code, pull from a recent backup if you must, and then use Xcode's Product menu with the option key pressed and select 'Clean Build Folder'. Confirm no errors in the navigator and go again.

Accepted Answer

Hundreds...ouch.


Instead of 'if/else', you might want to change to switch statements. From the docs:


"A switch statement considers a value and compares it against several possible matching patterns. It then executes an appropriate block of code, based on the first pattern that matches successfully. A switch statement provides an alternative to the if statement for responding to multiple potential states."


In any case, regardless of how many ifs you have, it's typically a fumbled fingered entry hiding in the ranks that suddenly knocks the cup to the floor. Confirm your code, pull from a recent backup if you must, and then use Xcode's Product menu with the option key pressed and select 'Clean Build Folder'. Confirm no errors in the navigator and go again.

if-else length crash?
 
 
Q