HomeiOS Developmentswift - Is a FileHandle.synchronize() nonetheless needed on iOS if closing the...

swift – Is a FileHandle.synchronize() nonetheless needed on iOS if closing the file?


On Home windows and Linux programs (fairly often when working inside non Hyper-V VMs with NTFS inside aligned .vhdx, much less typically on the bodily disk however there too) an unintended energy loss may trigger a just lately written file to be corrupted with junk (or null bytes).

Some important Linux providers create mamy backups for the settings file. Just like the iSCSI goal (LIO) which creates 10 backups for the /and so on/goal/saveconfig.json

Whereas iOS units do a clear shutdown when the battery is nearly depleted there are nonetheless eventualities the place unintended energy loss can occur: like freezing which causes the battery to instantly and unexpectedly lose an excessive amount of amperage.

I’ve an identical state of affairs the place a selected settings file is important in an iOS app.

Do FileHandle.shut() or Knowledge.write(choices: .atomic) on Swift iOS additionally flush to disk?

Ought to I keep away from String.knowledge.write()?

Is a FileHandle.synchronize() nonetheless needed on iOS to ensure cached knowledge has been written to storage?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments