美文网首页
iOS 抛出异常@throw

iOS 抛出异常@throw

作者: 管乐_VICTOR | 来源:发表于2018-03-28 11:06 被阅读372次

    有时候我们项目需求,需要人为的抛出异常,使程序崩溃退出,这时候就用到@throw了

        @throw [NSException exceptionWithName:@"context show" reason:@"crush's reason" userInfo:nil];
    

    运行程序就会出现如下打印结果:

     Terminating app due to uncaught exception 'context show', reason: 'crush's reason'
    

    相关文章

      网友评论

          本文标题:iOS 抛出异常@throw

          本文链接:https://www.haomeiwen.com/subject/xidycftx.html