intsig171 / SmartCodable

SmartCodable is a data parsing library based on Codable. It is simple to use, with robust compatibility being one of its main features. SmartCodable 是基于Codable实现的数据解析库。简单易用,强悍的兼容性是SmartCodable的主要特点。 表层API和功能几乎和HandyJSON一致,支持快速的迁移。
https://smart-codable.vercel.app
MIT License
356 stars 38 forks source link

感谢您的作品,当时在使用过程中遇到了崩溃 #39

Closed bilibili11 closed 1 month ago

bilibili11 commented 1 month ago

有两处崩溃,但是崩溃数量非常少,我也没有查到到底是哪种情况 1: 0 SmartCodable 0x18080 LogCache.alignTypeNamesInAllSnapshots() + 156 (LogCache.swift:156) 1 SmartCodable 0x16e40 LogCache.formatLogs() + 31 (LogCache.swift:31) 2 SmartCodable 0x3b904 specialized static SmartLog.printCacheLogs(in:) + 73 (SmartLog.swift:73) 3 SmartCodable 0x30520 SmartJSONDecoder.decode(_:from:) + 55 (SmartJSONDecoder.swift:55)

2: 0 SmartCodable 0x298bc specialized _NativeDictionary._insert(at:key:value:) + 40 (:40) 1 SmartCodable 0x18d60 specialized Dictionary.Variant.setValue(:forKey:) + 192 (:192) 2 SmartCodable 0x16c1c LogCache.cacheLog(:className:) + 145 (LogCache.swift:145) 3 SmartCodable 0x36df4 logInfo #1 () in SmartJSONKeyedDecodingContainer.smartDecode (forKey:entry:) + 920 4 SmartCodable 0x366a0 SmartJSONKeyedDecodingContainer.smartDecode(forKey:entry:) + 256 (SmartJSONKeyedDecodingContainer+decode.swift:256) 5 SmartCodable 0x34838 SmartJSONKeyedDecodingContainer.decode(:forKey:) + 25 (SmartJSONKeyedDecodingContainer+decode.swift:25) 6 SmartCodable 0x31a2c protocol witness for KeyedDecodingContainerProtocol.decode(_:forKey:) in conformance SmartJSONKeyedDecodingContainer + 28 (:28)

intsig171 commented 1 month ago

你用的应该是V3.0+版本吧? 请升级最新版本,该问题已经解决。 问题出现在 LogCache中字典的使用问题上。 同时多个解析发生时,导致非线程安全的字典的读写出现了问题。

bilibili11 commented 1 month ago

当前使用的是SmartCodable (4.1.1)版本,崩溃手机系统为17.5.1,感谢您的回答

intsig171 commented 1 month ago

可否帮在你的podlfile.locck中中确定一下版本号。 因为: 2 SmartCodable 0x3b904 specialized static SmartLog.printCacheLogs(in:) + 73 (SmartLog.swift:73) 这个方法,在新的版本中才改的,在V4.1.1版本上它的位置应该是这样的。 image

如果方便加一下我的QQ: 562863544

intsig171 commented 1 month ago

V4.1.2已修改该问题。 该问题是高并发下日志记录使用的字典线程处理上出现了问题。