iOS 10 Beta 6 - Swift 3 - JSONSerialization EXC_BAD_ACCESS

Originator:adam.putinski
Number:rdar://27925788 Date Originated:8/19/16
Status:Open Resolved:
Product:iOS Product Version:10.0
Classification:Bug Reproducible:Yes
 
Summary:

Using Xcode 8 Beta 6 along with iOS 10 Beta 6 (Swift 3), if you try to call JSONSerialization.data(withJSONObject: value, options: options) or JSONSerialization.isValidJSONObject() it will crash with EXC_BAD_ACCESS when a String is cast to Any

Steps to Reproduce:

Run the following code using Xcode 8 Beta 6 on an iOS device/simulator running iOS 10 Beta 6. This does not happen inside a Playground.

let a: [String:String] = ["hello": "a"]
let b: [String:Any] = ["hello": "b"]
// No crash
print(JSONSerialization.isValidJSONObject(a))
// Crash
print(JSONSerialization.isValidJSONObject(b))

Comments

UPDATE: I was finally able to reproduce the issue reliably:

https://gist.github.com/aputinski/74416727b4e1153b9cee3708f544d809

By adam.putinski at Aug. 19, 2016, 9:37 p.m. (reply...)

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!