How to efficiently write large files to disk on background thread (Swift)

后端 未结 3 1466
情话喂你
情话喂你 2020-12-22 18:56

Update

I have resolved and removed the distracting error. Please read the entire post and feel free to leave comments if any questions remain.

3条回答
  •  旧时难觅i
    2020-12-22 19:22

    You should consider using NSStream (NSOutputStream/NSInputStream). If you are going to choose this approach, keep in mind that background thread run loop will need to be started (run) explicitly.

    NSOutputStream has a method called outputStreamToFileAtPath:append: which is what you might be looking for.

    Similar question :

    Writing a String to an NSOutputStream in Swift

提交回复
热议问题