How to cancel a cloudKit operation due to timeout in Swift? -


i looking how cancel cloudkit operation due given timeout setting? case use ckmodifyrecordsoperation upload changes icloud, if failed, save failed records local storage. something, operation take long time...

so, want set timeout 60 seconds on operation, if timeout, cancel operation. use sleep func, though not in main thread, makes every added operation run @ least 60s. know not right solution. code below:

let uploadoperation = ckmodifyrecordsoperation(recordstosave: recordstosave, recordidstodelete: recordidstodelete) uploadoperation.modifyrecordscompletionblock = { (savedrecords, deletedrecordids, error) in     if let error = error {         ...         cloudkitmanager.persistentfailedrecords(savefailed, deletefailed)     }  }  cloudkitmanager.privatedb.add(uploadoperation)      sleep(60) if uploadoperation.isexecuting {     uploadoperation.cancel() } 

i did search timeout on operation, answer focus on nsurlsession, no answer cloudkit operation. , tried own property "timeoutintervalforrequest", doesn't work.

any appreciated! thank you!


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -