ckrecord - CloudKit- update record: "client oplock error" when updating record using "saveRecord" -


i trying update ckrecord public databse. , downloading works well.

func updatepublicrecord() {           let database:ckdatabase = ckcontainer.defaultcontainer().publicclouddatabase            if let myid = self.id {               database.fetchrecordwithid(myid, completionhandler: { (myrecord, error) in                   if error != nil {                        print("error fetching record: \(error!.localizeddescription)")                    } else {                        print("publicrecord fetched")                       myrecord!["name"] = self.name                     //and more code change other properties                      //save icloud                        ckcontainer.defaultcontainer().privateclouddatabase.saverecord(myrecord!) { [unowned self] (record, error) -> void in                           dispatch_async(dispatch_get_main_queue()) {                               if error == nil {                                print("update success")                                } else {                                   print("error in update public: \(error!.localizeddescription)")}            }             }            }             })           }       }   

this works updating in privateclouddatabase, public database error:

error in update public: error saving record ckrecordid: 0x7f855dbcdb70; f3c192c8-6e81-493e-9e1a-75c5f3826f78:(_defaultzone:defaultowner) server: client oplock error updating record

what mean? should update public record?

you have copy , paste problem. fetching public database trying save private database.

change this:

ckcontainer.defaultcontainer().privateclouddatabase.saverecord(myrecord!) { [unowned self] (record, error) -> void in   

to:

ckcontainer.defaultcontainer().publicclouddatabase.saverecord(myrecord!) { [unowned self] (record, error) -> void in   

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -