Hi guys,
I am using custom implementation of Hashable protocol on my classes/enums using fairly primitive logic using Hasher.combine() on several String/Int based fields.
Everything seems to be working really well on Linux, macOS, and iOS 10, 11, 12, 13, 14.
On iOS 9 with the app compiled using Xcode 11.5 and Xcode 11.6 however I started receiving lot of random crashes where my custom object/enum used as a key in a Set or Dictionary is not there, swift crashes with Set or Dictionary containing duplicate keys, etc.
It all points toward some kind of issue where for my custom objects used as keys during the app run Hasher.combine() is called multiple times for the same object with different random seed, thus generating different hashValue for the same object during the same app run.
To indicate, here is the precondition on line 5 that fails:
I'm trying to figure out whether this rings a bell for somebody since it is 100% iOS 9 specific.
thanks for any pointers,
Martin
I am using custom implementation of Hashable protocol on my classes/enums using fairly primitive logic using Hasher.combine() on several String/Int based fields.
Everything seems to be working really well on Linux, macOS, and iOS 10, 11, 12, 13, 14.
On iOS 9 with the app compiled using Xcode 11.5 and Xcode 11.6 however I started receiving lot of random crashes where my custom object/enum used as a key in a Set or Dictionary is not there, swift crashes with Set or Dictionary containing duplicate keys, etc.
It all points toward some kind of issue where for my custom objects used as keys during the app run Hasher.combine() is called multiple times for the same object with different random seed, thus generating different hashValue for the same object during the same app run.
To indicate, here is the precondition on line 5 that fails:
Code Block 1. let key = SomeKey() 2. let dict = [:] 3. precondition(dict[key] == nil, "SomeKey must not be present") 4. dict[key] = SomeObject() 5. precondition(dict[key] != nil, "SomeKey must be present")
I'm trying to figure out whether this rings a bell for somebody since it is 100% iOS 9 specific.
thanks for any pointers,
Martin