Does -dataWithContentsOfURL: of NSData work in a background thread?

前端 未结 7 1501
南笙
南笙 2020-12-30 05:39

Does -dataWithContentsOfURL: of NSData work in a background thread?

7条回答
  •  没有蜡笔的小新
    2020-12-30 06:26

    No, this will block the thread and you will load the contents of file into the RAM. You can download content directly into file without temporary NSData to avoid huge RAM usage. Something like this solution https://stackoverflow.com/a/6215458/2937913

提交回复
热议问题