Closed tamirbb closed 3 years ago
Facing same.
Same problem
I found that it can be related to NSString-backed strings. For example:
let swiftStr = "string with html entities"
_ = swiftStr.removingHTMLEntities // no crash
but:
let nsStr = NSString("string with html entities")
let str = nsStr as String
_ = str.removingHTMLEntities // crash!
To solve this we can force Swift to convert string storage by any mutation on a String, for example:
let nsStr = NSString("string with html entities")
var str = nsStr as String
str.append("a")
str.removeLast(1)
_ = str.removingHTMLEntities // no crash
@OlegKetrar Thanks for posting, It's NSString related in my case as well, I'll try your workaround. Thanks!
I tried it but It didn't work in my case
@JCSooHwanCho made a PR that changes the logic to no longer use indices. Can y'all check if updating to 6.0.0
fixes the issue?
@alexaubry It may fixed in 6.0.1
. Any crash doesn't reported yet.
This issue is iOS 13 specific.
We use the
removingHTMLEntities
property on long html strings. We see this crash on rare occasions - about 800 cases per 1 million sessions. It also seems that similar calls on the same string would not result in a crash. So we believe this is a threading issue.Crashlytics data:
crash_info:
Fatal error: file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/swiftlang/install/TempContent/Objects/BNI_iOS/swift-macosx-x86_64/stdlib/public/core/8/UnsafeBufferPointer.swift, line 886
Stack trace: