Please note that long running operations should be avoided at startup:
- Bad user experience (delay and fraud behavior)
- Watchdog on iOS can kill your app as if itβs stuck.
So, copy in the secondary stream (or in an operation ... or in any other case a different execution path is used).
Another problem arises if you need data to populate the user interface: in this case:
- Disable UI Elements
- Run the async / threaded operation
- At the end of the copy call (through a notification, protocol .. or other means) to notify the UI, it can begin to receive data.
For example, we copy a ZIP file and unpack it, but it takes some time, so we had to put it in a timer procedure, which will start the interface after completion.
If you need an example, let me know what I know.
PS:
Copying using a ZIP file is more efficient:
- File system call only
- Much less bytes to copy
The bad news: you have to use a routine to unzip the zip file, but you can find them on the Internet.
Decompressing Zip files should be more efficient, as these calls are recorded in direct C, and not in Cocoa with all the overhead.
source share