Catching exceptions in objective-c

纵然是瞬间 提交于 2019-12-12 04:20:43

问题


Is there some sort of try/catch function in obj-c? I'm trying to load saved files from an array and would like to have some sort of message popping up instead of the app crashing in case the array is empty. Whats the best and optimal way to do this?


回答1:


@try {
    //Code
} 
@catch (id theException) {
    //Code
} 
@finally {
    //Code
}

Or you can test if the array is empty ...



来源:https://stackoverflow.com/questions/6569602/catching-exceptions-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!