ios simulator - Saving Record in CloudKit not working [Swift 3] -
i trying save record have make in cloudkit dashboard.
@ibaction func signuppressed(_ sender: anyobject) { let authinfo = authinfo() authinfo.email = emailfield.text! authinfo.firstname = firstfield.text! authinfo.lastname = lastfield.text! authinfo.username = usernamefield.text! authinfo.password = passwordfield.text! let container = ckcontainer.default() let privatedata = container.privateclouddatabase let record = ckrecord(recordtype: "authentication") record.setvalue(authinfo.email, forkey: "email") record.setvalue(authinfo.username, forkey: "username") record.setvalue(authinfo.firstname, forkey: "firstname") record.setvalue(authinfo.lastname, forkey: "lastname") record.setvalue(authinfo.password, forkey: "password") privatedata.save(record, completionhandler: { record, error in if error != nil { print(error) } else { }
and, i'm pretty sure code ok. (cloudkit framework imported , cloudkit enabled valid developer account , container, no issue there) error saying have authorised account when try , run code. however, other similar questions seemed have been solved making sure logged in icloud on simulator (i using xcode 8), have checked , double checked logged in icloud, have no idea issue is. how can around this. code?
your code looks fine. has authentication.
are using new icloud test account or developer account? if brand new account try log in in browser via icloud.com first.
another option reset simulator (reset content , settings
) , setup icloud again in settings > icloud
.
Comments
Post a Comment