Open kidsid49 opened 8 years ago
I'm getting the same crash with iPhone 6, 5, and iPod touch 6g, so I'm assuming it affects all devices.
It looks like it's caused by the range parameter of removeAttributeWithBoundsCheck having a negative (very high positive integer) length. Tracing the thread up, I think it's related to truncation.
These are my values in removeAttributeForTruncatedRange:
NSRange availableRange = NSMakeRange(self.truncatedPatternRange.location, self.textStorage.length - self.attributedTruncationToken.length - self.truncatedPatternRange.location);
(NSRange) availableRange = location=75, length=4294967292 self.textStorage.length = 77 self.attributedTruncationToken.length = 6 self.truncatedPatternRange.location = 75
This change fixed the issue for me:
- (void)removeAttributeForTruncatedRange {
NSDictionary *patternAttributes = [self.rangeAttributeDictionary objectForKey:[NSValue valueWithRange:self.truncatedPatternRange]];
[patternAttributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
NSInteger truncatedPatternRangeLocation = self.truncatedPatternRange.location;
if(truncatedPatternRangeLocation + self.attributedTruncationToken.length > self.textStorage.length) {
truncatedPatternRangeLocation = self.textStorage.length - self.attributedTruncationToken.length;
}
NSRange availableRange = NSMakeRange(truncatedPatternRangeLocation, self.textStorage.length - self.attributedTruncationToken.length - truncatedPatternRangeLocation);
[self.textStorage removeAttributeWithBoundsCheck:key range:availableRange];
}];
}`
Your inclusion of new category in latest commits keeps crashing on iPhone 5 family device. any clue?
line 29 -[NSMutableAttributedString(BoundChecker) removeAttributeWithBoundsCheck:range:](exc_bad_access kern_invalid_address) That's why what my crashanalytics showing me.
Crashed: com.apple.main-thread