I started to study memory leaks recently, and I cannot understand why JSON serialization causes a leak.
class func convertDataToDictionary(resultData: NSData) -> [String:AnyObject]{ do{ let json = try NSJSONSerialization.JSONObjectWithData(resultData, options: .AllowFragments) as? [String:AnyObject] if json != nil{ return json! } } catch{ print(error) } return [String:AnyObject]() }
I use this function to convert NSData to a dictionary. I also added a screenshot of the leak.

This does not cause any serious problems with the application, but I would still like to know why this is happening. Any help is appreciated. Thanks!
source share