I'm working on an app that can remove large amounts of files. When I invoke the NSFileManager's removeItemAtPath method, the app's UI locks until the operation finishes (this can take a while).
I tried fixing this by invoking the method using performSelectorInBackground but it didn't work.
Any ideas?
Thanks in advance.
You could try using GCD to do it in a background thread.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
[[NSFileManager defaultManager] removeItemAtPath:path];
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.