Home > DeveloperSection > Forums > Throwing an Exception in Objective-C
Felix Pickles
Felix Pickles

Total Post:24

Posted on    October-23-2015 12:05 AM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 633  View(s)
Rate this:

I was learning Objective-C and trying to create apps, but some times I am getting exceptions in my code.

Can anyone tell me the best way to handle exceptions in iOS.

Tarun Kumar

Total Post:214

Posted on    October-23-2015 1:17 AM

I will prefer NSException class to handle exceptions in our program,
I use [NSException raise:format:] as follows:

[NSException raise:@"Invalid value" format:@"Code %d is invalid", str];

Don't want to miss updates? Please click the below button!

Follow MindStick