samodom / TestableUIKit

Spies for UIKit components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intermittent failure of associated boolean values

samodom opened this issue · comments

See tests using UIWebView.loadHtmlStringCalled

It appears this is due to multiple keys having the same pointer address -- hence, they are the same keys.

The solution that is working for me now is to allocate C strings and point to them -- I'm using UUIDs to generate unique strings:

private let keyString = NSUUID().uuidString.cString(using: .utf8)!
let key = ObjectAssociationKey(keyString)