Swift 3.1 / Xcode 8.3 - abnormal KVO crash
| Originator: | apps | ||
| Number: | rdar://31405343 | Date Originated: | April 3rd 2017 |
| Status: | Open | Resolved: | |
| Product: | macOS + SDK | Product Version: | 10.12.4 (16E195) |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Area: Xcode Summary: Swift 3.1 / Xcode 8.3 brought a bug regarding KVO notification and Swift dictionaries. When a label is bound (cocoa bindings) to a dynamic Swift dictionary value, and the value is updated, the app crashes with a following message: Cannot update for observer for the key path "myDict.String" from , most likely because the value for the key "myDict" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the exceptiontest.ViewController class. Steps to Reproduce: 1. Create a simple mac app with a button and a label 2. Bind the label to a dictionary dynamic var myDict = ["String":"Initial String"] using the keypath myDict.String 3. Create an action on the button changing the value of myDict["String"] => app crashes OR download the attached Xcode project for your convenience... Expected Results: Label to updated its value. Actual Results: App crashes with the following error message: Cannot update for observer for the key path "myDict.String" from , most likely because the value for the key "myDict" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the exceptiontest.ViewController class. Version: 10.12.4 (16E195) Notes: Configuration: Xcode 8.3 Attachments: 'testappmac.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!