objective-c - ioscrash 追查

查看:130
本文介绍了objective-c - ioscrash 追查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

crash 信息

SEGV_ACCERR
cardloan -[HomeMoneyView refreshView] (HomeMoneyView.m:)

cardloan    -[HomeMoneyView refreshView] (HomeMoneyView.m:89)
5 cardloan    -[HomeMoneyTextFiedTablieViewCell initWithStyle:reuseIdentifier:] (HomeMoneyTextFiedTablieViewCell.m:61)

@try {
        
        // 刷新每期费用
        CGFloat monthMoney = [[MoneyLoan sharedInstance] getPeriodsFeeWithMoney:[_moneyTextField.text floatValue] periods:_periods];;
        
        NSString *approvedAmountStr = [NSString stringWithFormat:@"%@元", [NSString moneyToStrings:monthMoney]];
        NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:approvedAmountStr];
        [attrStr setAttributes:@{
                                 NSFontAttributeName:kFont(15.)
                                 }
                         range:NSMakeRange(attrStr.length - 3, 3)];
        _monthMoneyLabel.attributedText = attrStr;
        
        _circleLayer.progress = [_moneyTextField.text floatValue] / _moneyTextField.moneyRange.max;
        
    } @catch (NSException *exception) {
        
    } @finally {
        
    }

89行是这句, 不知道为啥会崩溃

[attrStr setAttributes:@{
                                 NSFontAttributeName:kFont(15.)
                                 }
                         range:NSMakeRange(attrStr.length - 3, 3)];

解决方案

attrStr.length < 3

这篇关于objective-c - ioscrash 追查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆