JSONSerialization crashes when Optional is contained in argument to data(withJSONObject:options)
Originator: | dloewenherz | ||
Number: | rdar://28365419 | Date Originated: | 19-Sep-2016 11:44 AM |
Status: | Duplicate/22965460 | Resolved: | |
Product: | iOS SDK | Product Version: | iOS 10 |
Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary: See title. Steps to Reproduce: 1. Download the attached sample project and open in Xcode or run the following code in a playground: import Foundation let name: String? = "Spike" let dogNames: [Any] = [name] do { try JSONSerialization.data(withJSONObject: dogNames, options: .prettyPrinted) } catch { print("HI") } Expected Results: An exception is raised by JSONSerialization and the string "HI" is printed to the console. Actual Results: The playground source file has a runtime error and SIGABRTs. Version: iOS 10 Notes: Configuration: iPhone SE Attachments:
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!