小编tom*_*der的帖子

iOS崩溃报告"意外启动状态"异常?

我找到了几个崩溃报告的原因unexpected start state.我的代码看起来像这样:

NSRange range = [content rangeOfString:@"<html>"];

if (range.location != NSNotFound) {
    NSString *htmlStr = [content substringFromIndex:range.location];

    NSAttributedString *attStr = [[NSAttributedString alloc] initWithData:[htmlStr dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];

    return attStr.string;
}
Run Code Online (Sandbox Code Playgroud)

崩溃报告如下所示:

在此输入图像描述

crash nsexception ios nsmutableattributedstring

25
推荐指数
2
解决办法
4108
查看次数