• Bug集


    ##常识性错误

      报错中 大量错误信息结尾.o后缀的 ,一般是引用头文件 import了 .m 文件

    ##tableView

     1>设置table view的行数时出错

    6-04-15 20:33:01.728 lol可编辑[7016:239219] -[ViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7fb362e13200

    2016-04-15 20:33:09.662 lol可编辑[7016:239219] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7fb362e13200'

    *** First throw call stack:

     2>控件连线设置的名或者自定义的属性名与系统的关键字重名 比如imageView

     /Users/qianlishun/Desktop/UI基础/Day07/test/团购案例/团购案例/GoodsCell.m:15:41: Auto property synthesis will not synthesize property 'imageView' because it is 'readwrite' but it will be synthesized 'readonly' via another property

      

      3> contentSize: {320, 712.705078125}>) failed to obtain a cell from its dataSource (<ViewController: 0x7fb992e1ff00>)'

    创建一个cell ,会先看缓存池有没有,然后看storyboard,再看代码
    后者会覆盖前者
     
    static NSString *ID = @"message_cell";
        MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    //    if (cell == nil) {                  // 调用了initWithStyle方法,再去重写它以满足需要
    //        cell = [[MessageCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    //    }
    报错解决: 1. 在viewDidload里注册一个cell
                      2.在storyboard里建一个,然后标识
                        3. 如上注释的 判断,在创建
     
     
     
      4> 错误提示是 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7fd1130f1e00; frame = (0 0; 414 736); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x7fd11266a3f0>; layer = <CALayer: 0x7fd11480dfe0>; contentOffset: {0, -64}; contentSize: {414, 44}>) failed to obtain a cell from its dataSource (<_UIFilteredDataSource:
     
         原因: 没有注册cell
     
      解决  [self.tableView registerClass:[UITableViewCell class]forCellReuseIdentifier:ID];
     
    ##   
     
    *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FlagView 0x7fc523531a90> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imgViewicon.'
     
      原因,   imgVIewIcon这个控件没有绑定给 视图 中的控件 (即没有连线,这个类找不到key)
     
     *** CUICatalog: Invalid asset name supplied: (null)
      有文件没有加载,比如      self.imgViewPicture.image = [UIImage imageNamed:weibo.picture];
      但 “weibo.picture" 为空(nil)
     
    ##
    UIAlertController
     
     1 // 创建一个确定按钮”一定要注意不能在提醒控制器的按钮的点击方法内部用到提醒控制器自己”,不能把下面这句话放在block内部”不然会死循环,导致警告控制器不能销毁"
     2     UITextField *textField = alertC.textFields.firstObject;
     3 
     4     UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
     5        
     6        hero.name = textField.text;
     7         [self.tableView reloadData];
     8        
     9 //        [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
    10 //        [alertC dismissViewControllerAnimated:NO completion:nil];
    11     }];
     
  • 相关阅读:
    MFC单文档中进行plc点云显示
    modbus发送和接收
    测试左移和测试右移
    2021软件测试笔试题
    202106月份总结测试开发面试题
    KuaiShou面试题
    阿拉伯数学手写体。
    GeminiScrollbar
    vue-core-video-player
    webpack
  • 原文地址:https://www.cnblogs.com/qls1992/p/5477826.html
Copyright © 2020-2023  润新知