I want to know which are the possible places where an iPhone application will raise any exception.
there are many but any has a list that can say that these are possible areas where any exception can be raised by the application.
I tries int i = 1/0 ;but it returned 0 and goes to the next part, as per my knowledge it should raise exception and should g开发者_运维技巧o to the catch part.
Thanks in advance
In a language such as Java division by zero would raise an exception. However, in C (and so in Objective-C), the behaviour is undefined. It will not raise an exception. You should manually check for division by zero condition.
From ISO/IEC 9899 - Programming languages - C:
The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.
You can read all about exceptions on iPhone in Exception Programming Topics for Cocoa
精彩评论