首页 > 移动平台 > 详细

iOS开发中得一些记录

时间:2015-01-02 12:12:38      阅读:293      评论:0      收藏:0      [点我收藏+]

没看明白之一:

Error handling

When methods return an error parameter by reference, check the returned value, not the error variable.

Preferred:

NSError *error = nil;
if (![self trySomethingWithError:&error]) {
    // Handle Error
}

Moreover, some of Apple‘s APIs write garbage values to the error parameter (if non-NULL) in successful cases, so checking the error can cause false negatives (and subsequently crash).

iOS开发中得一些记录

原文:http://www.cnblogs.com/memorecool/p/4198237.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!