码迷,mamicode.com
首页 > 移动开发 > 详细

iOS开发中得一些记录

时间:2015-01-02 12:14:34      阅读:146      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!