throwing an exception in objective-c/cocoa

后端 未结 13 1620
耶瑟儿~
耶瑟儿~ 2020-11-29 15:01

What\'s the best way to throw an exception in objective-c/cocoa?

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 15:09

    You can use two methods for raising exception in the try catch block

    @throw[NSException exceptionWithName];
    

    or the second method

    NSException e;
    [e raise];
    

提交回复
热议问题