objective c - recycleURLs:completionHandler: with NIL makes it block until completion? -


i sending file trash with

[nsworkspace recycleurls: myarrayofonensurl              completionhandler: nil] 

myarrayofonensurl nsarray created arraywithobject: of single nsurl created absolute file path fileurlwithpath:isdirectory:.

the normal way tell if successful use completionhandler , check if 2nd arg (nserror) nil, means success.

is there anyway check success without callback? have setup loop after calling this, check file existence, if 1second has past , still exists, declare fail. wondering if set nil second arg recycleurls:completionhandler: make block until process completes (regardless of success)? in tests, first check finds file no longer @ original place (meaning trashed), i'm not sure if computer super fast, or blocking until file operation completes.

for trashing single file or directory, can use nsfilemanager trashitematurl instead. synchronous, avoid headaches completion callback.

nserror * error = nil; [[nsfilemanager defaultmanager] trashitematurl:url resultingitemurl:nil error:&error]; 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -