iOS Download & Parsing Large JSON responses is causing CFData (store) leaks

前端 未结 1 1611
时光说笑
时光说笑 2021-01-17 03:04

The first time a user opens my app I need to download lots of data. I get all of this data from the server in JSON form. Depending on the user, these JSON files can be anywh

相关标签:
1条回答
  • 2021-01-17 03:53

    I use the native JSON conversion functions with massive amounts of data with no memory problems.

    I just use a standard NSURLConnection to download the NSData then do the following...

    NSData *data = [NSURLConnection sendSynchronous...
    
    // use NSDictionary or NSArray here
    NSArray *array = [NSJSONSerialization JSONObjectWithData:data ...
    
    Now deal with the objects.
    

    No leaks as it's a native function. A lot quicker than third parts frameworks.

    0 讨论(0)
提交回复
热议问题