One useful tip I’ve been using for XCode is adding breakpoints on exceptions.
I was wondering why we need to add two breakpoints–one for objc_exception_throw and one for [NSException raise].
What cases do one cover that the other doesn’t?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should only use a breakpoint on
objc_exception_throw. The method-[NSException raise]callsobjc_exception_throw, soobjc_exception_throwcovers all cases that-[NSException raise]covers. The other way around is not true: The@throwdirective is compiled to callobjc_exception_throwdirectly. This method shows the difference:When calling
-throwAndCatch, a breakpoint on-[NSException raise]has no effect, while a breakpoint onobjc_exception_throwwill work.