I have started looking into memory leaks recently and I'm not able to figure out why JSON serialization is causing 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'm using this function to convert NSData into a dictionary. I've also attached a screenshot of the leak.
This isn't causing any major issues with the app, but I'd still like to know why it's happening. Any help is appreciated. Thanks!