简体   繁体   English

CLLocationCoordinate2D到LocationList

[英]CLLocationCoordinate2D to LocationList

Can I save the content of a CLLocationCoordinate2D array into a LocationList (Cloud Kit field type) ? 我可以将CLLocationCoordinate2D数组的内容保存到LocationList(Cloud Kit字段类型)中吗?

Here is what I've done, the TTitre is saved into the DB but not my CLLOcationCoordonate2D array 这就是我所做的,TTitre已保存到数据库中,但没有保存到我的CLLOcationCoordonate2D数组中

    let database = CKContainer.default().publicCloudDatabase

    var TraceTitre = "Titre" as CKRecordValue
    var TabAsCK = traces as CKRecordValue


    let newTrace = CKRecord(recordType: "Trace")
    newTrace["TTitre"] = TraceTitre
    newTrace["TTrace"] = TabAsCK

    database.save(newTrace, completionHandler: { (record:CKRecord?, error:Error?) -> Void in
        if error != nil{
            print("Record OK \(record)")
        }
    })

Merci d'avance, Florian 弗洛里安(Morci d'avance)

Ok so I solved the issue : You can't save a CLLocationCoordinate array but only a CLLocation array. 好的,所以我解决了这个问题:您不能保存CLLocationCoordinate数组,而只能保存CLLocation数组。 But if someone can explain me why ? 但是,如果有人可以解释我为什么? Because CLLocationCoordinate2D can store only latitude and longitude values (which fit perfectly with a Location List field) contrary to CLLocation who can store Latitude, Longitude but also altitude... 因为CLLocationCoordinate2D只能存储纬度和经度值(完全适合“位置列表”字段),所以与CLLocation相反,CLLocation可以存储纬度,经度以及海拔高度...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM