您的当前位置:首页正文

有意思的bug

来源:图艺博知识网

服务器数据比较多,返回数据时,难免有些字段会出错。
如果是一个string字段,如果服务器写错,返回long类型。
客户端处理时就需要小心了。下面是我的一个错误吧。

@property (nonatomic, copy) NSString *shortName;
shortName.length;//此处造成崩溃。
为了安全起见,[NSString stringWithFormat:@"%@",shortName].length;

如下错误代码

    @autoreleasepool {
        for (UIView *view in [self subviews])
        {
            if (view.tag==100)
            {
                return;
            }
        }
    }

info.plist文件中的Supported interface orientations数组的顺序竟然会影响launchScreen显示方式(横屏还是竖屏)。launchScreen默认取第一个item的值显示,实践出真知啊。

Supported interface orientations
Documentation for isBeingPresented - This method returns YES only when called from inside the viewWillAppear: and viewDidAppear: methods. 
Top