In my code, if an exception arises, then I want to convert that exception into an error and then want to hit a service (to log this error on server). Does anybody has any idea, how to do it?
One more question, suppose I have a method which calls another method (of another class) which in turn calls another method of any other class, that is, method A of class A calls method B of class B, which calls method C of class C. So, where should I put the try-catch block in my code? (in method A, in method B, in method C or in all three methods)
In my code, if an exception arises, then I want to convert that exception
Share
For more information on exception handling you can refer the apple documentation
http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocExceptionHandling.html
Now for your next question i.e where to put the try catch block.
method A of class A calls method B of class B, which calls method C of class C, hence you can see in this process the thread will be same and the memory stack will be same also.
hence apply the try catch block in the class A. hence it will handle the exception raised by the other classes i.e B and C.(As the exception are global)
But you want that the exception of different classes should be handled individually so apply the try catch in those classes.