what is the syntax for handle the exceptions in iphone sdk? how to handle the exceptions in iphone. what documentation to know more about? tutorial, sample code are most wanted and thankful.
Exceptions in Objective-C are quite a contentious issue, even Apple themselves discourage you from using them unless absolutely necessary.
My first question would be what do you want to achieve from the exception handling? If you're looking from a Java perspective and how exceptions are so tightly integrated in that language for handling errors (i.e. flow control) then I think it's unadvisable to use objective-c exceptions for this purpose, you need to use NSError and handle errors that way.
This is a snippet from Apples documentation: -
Exceptions are resource-intensive in Objective-C. You should not use exceptions for general flow-control, or simply to signify errors. Instead you should use the return value of a method or function to indicate that an error has occurred, and provide information about the problem in an error object. For more information, see Error Handling Programming Guide For Cocoa.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With