Friday, 29 May 2015

Throw an exception in Obj C

I've just been implementing HockeyApp and GetSentry crash reporting in one of our iOS native apps, and this handy piece of code came in useful for testing what happens when an exception is thrown.


   
        NSException* myException = [NSException
                                    exceptionWithName:@"TestExcpetion"
                                    reason:@"Just testing"
                                    userInfo:nil];
        @throw myException;

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!