作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们的 App Find a Foundation 崩溃,仅在 iOS11 中。如何解决?
Fatal Exception: NSRangeException
NSMutableRLEArray replaceObjectsInRange:withObject:length:: Out of bounds
0 CoreFoundation 0x184f8bd38 __exceptionPreprocess
1 libobjc.A.dylib 0x1844a0528 objc_exception_throw
2 CoreFoundation 0x184f8bc80 -[NSException initWithCoder:]
3 Foundation 0x18587c168 -[NSMutableRLEArray replaceObjectsInRange:withObject:length:]
4 Foundation 0x18588262c -[NSConcreteMutableAttributedString replaceCharactersInRange:withAttributedString:]
5 CoreFoundation 0x184e65bec -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
6 UIKit 0x18ec677b8 -[UILayoutManagerBasedDraggableGeometry draggableObjectsForTextRange:]
最佳答案
我可以在 iOS 13.0 beta 4 中使用示例应用程序重现它,该示例应用程序显示一个 UITextView,其中包含一个包含链接的特殊属性字符串。点击或拖动链接时它会崩溃。
NSMutableAttributedString *aString = [[NSMutableAttributedString alloc] initWithString:@""];
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [[UIImage imageNamed:@"weblink"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
attachment.bounds = CGRectMake(0, 0, 15, 15);
[aString appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
[aString appendAttributedString:[[NSAttributedString alloc] initWithString:@" More Information"]];
[aString addAttribute:NSLinkAttributeName value:[NSURL URLWithString:@"https://www.apple.com"] range:NSMakeRange(0, aString.length)];
self.textView.attributedText = aString;
关于crash - NSMutableRLEArray 中的 iOS11 崩溃 replaceObjectsInRange:withObject:length::Out of bounds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46945308/
我们的 App Find a Foundation 崩溃,仅在 iOS11 中。如何解决? Fatal Exception: NSRangeException NSMutableRLEArray re
我是一名优秀的程序员,十分优秀!