美文网首页
开发问题笔记(十五)

开发问题笔记(十五)

作者: Kevin_wzx | 来源:发表于2021-08-08 23:20 被阅读0次

    目录

    1.NSString字符串如何转为NSNumber
    2.运行出现:[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object
    3.删除列表某行数据时出现: reason: -[__NSArrayM objectAtIndexedSubscript:]: index 4 beyond bounds [0 .. 3]'
    4.监听App从后台返回前台
    5.客户端 Header
    6.腾讯上传图片SDK
    7.因为刷新没有在主线程造成的程序崩溃
    8.转发接口
    9.字典创建方法不同,为空的时候奔溃
    10.缺乏相对应的真迹调试包一直无法连接手机成功
    11.cell的不复用-用随机数
    12.本地做缓存
    13.乘客端订单详情页面的处理思路
    14.成都行政区域编码
    15.成都机场优化版本
    16.block修饰的问题
    17.字符串判断为空
    18.因为没有在主线程刷新报的UI刷新程序奔溃错误
    19.延迟操作
    20.处理苹果的深色模式
    21.WKWebview的dealloc方法奔溃
    22.Xcode可以删除的缓存数据,释放内存(cd ~/Library/Developer/Xcode)
    23.新版xcode12.5对一些特性定义不同
    24.键盘上面的完成按钮
    25.tableView一些小问题
    26.再次记录Model中自定义类名、属性名、数组等转换
    27.Jason串转字典(Jason串:后台返回是个字符串,字符串的内容是个字典形式)
    28.iOS 浮点数的精确计算和四舍五入问题
    29.如何处理target has frameworks with conflicting names: xx.framework错误
    30.DoraemonKit(一款功能齐全的客户端( iOS 、Android、微信小程序、Flutter )研发助手,你值得拥有)

    1.NSString字符串如何转为NSNumber

    https://blog.csdn.net/zx6268476/article/details/45919287

    2.运行出现:[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object

    https://blog.csdn.net/xiaoning0905/article/details/89306924

    3.删除列表某行数据时出现: reason: -[__NSArrayM objectAtIndexedSubscript:]: index 4 beyond bounds [0 .. 3]'

    https://blog.csdn.net/yuhao309/article/details/81382655

    4.监听App从后台返回前台

    5.客户端 Header

    http://117.29.166.14:8090/pages/viewpage.action?pageId=327733

    6.腾讯上传图片SDK

    https://cloud.tencent.com/document/product/436/11280

    7.因为刷新没有在主线程造成的程序崩溃

    比如网络请求数据,请求成功之后需要重新刷新布局控件,这个时候需要在主线程中去刷新UI,否则很容易造成程序奔溃,要注意。

    8.转发接口

    比如我们做数据上报功能的时候调用成都数据上报的接口是通过先调用我们这边后台的接口,成功之后再去调用成都那边的数据上报的接口,中间他们2个有对接,我们这边转发了一下成都那边的接口。

    转译接口返回.png

    9.字典创建方法不同,为空的时候奔溃

    10.缺乏相对应的真迹调试包一直无法连接手机成功

    http://www.voycn.com/index.php/article/xcodezhenjidiaoshibuletishi-please-reconnect-device

    缺乏相对应的真迹调试包一直无法连接手机成功.png

    11.cell的不复用-用随机数

    cell 标识符加数字不复用.png

    Xib的cell不复用:

    Xib的cell不复用 xib注册cell

    12.本地做缓存(未处理)

    1.新订单新的标识符,通过推送

    1.推送-数据源
    BBXDataReportCofigModel *model = [BBXDataReportCofigModel modelWithDictionary:dict];
                [model addDataReportMessage];
                NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
                if ([def objectForKey:@"NEW_DataReport"]) {
                    NSMutableArray * arr = [NSMutableArray arrayWithArray:[def objectForKey:@"NEW_DataReport"]];
                    [arr addObject:dict[@"id"]];
                    NSArray * arr2 = [NSArray arrayWithArray:arr];
                    [def setObject:arr2 forKey:@"NEW_DataReport"];
                    [def synchronize];
                } else {
                    NSArray *arr = @[dict[@"id"]];
                    [def setObject:arr forKey:@"NEW_DataReport"];
                    [def synchronize];
                }
    
    个人页跳转:
     [[NSNotificationCenter defaultCenter]postNotificationName:@"BBXDataReportRemoveNewDataNotification" object:nil userInfo:nil];//清除首页小红点
    
    
    首页:
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataReportRemoveNewDataNotification:) name:@"BBXDataReportRemoveNewDataNotification" object:nil];//数据上报清除小红点
    
    //数据上报清除小红点
    - (void)dataReportRemoveNewDataNotification:(NSNotification *)notifity{
        [self.dataReportCofigModel removeFormNewDataReportMessage];
        [self lodeDataReportingConfig];
    }
    

    2.货物订单备注一开始就有,关闭以后不展示

    缓存.png

    13.乘客端订单详情页面的处理思路

    14.成都行政区域编码

    15.成都机场优化版本

    成都机场优化.png

    判断当前成都是否定位成都:

    16.block修饰的问题

    https://www.jianshu.com/p/0ba8ebfefe9c

    block修饰错误.png block修饰正确.png

    17.字符串判断为空

    字符串判断为空.png

    18.因为没有在主线程刷新报的UI刷新程序奔溃错误

    没有在主线程刷新报错.png

    19.延迟操作

    WeakSelf
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         [weakSelf requestOrderDetail];//刷新页面
    });// 1为延迟多长时间
    
    延迟操作刷新界面

    20.处理苹果的深色模式

    21.WKWebview的dealloc方法奔溃

    奔溃信息翻译 解决办法

    22.Xcode可以删除的缓存数据,释放内存

    输入以下命令行:
    cd ~/Library/Developer/Xcode
    ls
    open .

    输入以下命令行:
    cd ~/Library/Caches
    ls
    open .

    23.新版xcode12.5对一些特性定义不同

    比如对强弱引用 比如代理协议

    24.键盘上面的完成按钮

    UITextField去掉键盘上面的完成按钮,修改UITextField的占位符颜色

    • 去掉键盘上面的完成按钮
    _searchTextField = [[UITextField alloc] init];
    _searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
    _searchTextField.placeholder = @"请输入目的地进行搜索";
    _searchTextField.returnKeyType = UIReturnKeySearch;//键盘设置搜索按钮
    [_searchBarBgView addSubview:_searchTextField];
    [_searchTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.iconImagerView.mas_right).offset(8);
        make.centerY.mas_equalTo(_searchBarBgView);
        make.top.mas_equalTo(0);
        make.right.mas_equalTo(0);
    }];
    
    UIToolbar *bar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0)];
    bar.hidden = YES;
    _searchTextField.inputAccessoryView = bar;//去掉键盘上面的完成按钮
    
    键盘有完成按钮图片
    • 修改占位符颜色
    UITextField *textField = [[UITextField alloc]init];
    NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
    attributes[NSForegroundColorAttributeName] = XzcWHITCOLOR;
    textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"搜索你想要播放的文件" attributes:attributes];
    
    • 修改光标颜色
    self.passwordTF.tintColor = [UIColor orangeColor];// 设置光标颜色
    

    25.tableView一些小问题

    • 1.滑动tableView收起键盘:

    _tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;//滑动收起键盘

    • 2.tap手势和tableView点击冲突

    比如下面搜索地址图中,会造成弹起键盘的时候,直接点击选择地址选择不了,需要先收起键盘才能点,也就是点2次才能选择地址。解决代码如下

    解决代码
    • 3.tableView分隔线顶格和隐藏多余cell

    [_tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];//分隔线顶格
    _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];//隐藏多余cell

    • 4.点击搜索框,滑动tableView或者点击完成按钮收起键盘的时候View被上移
    解决办法代码:
    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        [IQKeyboardManager sharedManager].enable = NO;//解决:收起键盘View上移的bug
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        [IQKeyboardManager sharedManager].enable = YES;//解决:收起键盘View上移的bug
    }
    
    正常View 正常View View上移 解决方法

    26.再次记录Model中自定义类名、属性名、数组等转换

    model.h文件 model.m文件

    27.Jason串转字典(Jason串:后台返回是个字符串,字符串的内容是个字典形式)

    devicePermission;//权限内容(Jason串)
    NSDictionary *deviceper = [[NSDictionary alloc]init];
    deviceper = [XXTollClass dictionaryWithJsonString:self.activityCodeModel.devicePermission];
    self.name = deviceper[@"name"];
    self.permission = deviceper[@"permission"];
    
    例子

    28.iOS 浮点数的精确计算和四舍五入问题

    https://www.jianshu.com/p/946c4c4aff33

    29.如何处理target has frameworks with conflicting names: xx.framework错误

    https://www.jianshu.com/p/a142d6bee8bf

    30.DoraemonKit(一款功能齐全的客户端( iOS 、Android、微信小程序、Flutter )研发助手,你值得拥有)

    https://github.com/didi/DoraemonKit

    相关文章

      网友评论

          本文标题:开发问题笔记(十五)

          本文链接:https://www.haomeiwen.com/subject/nzjavltx.html