简体   繁体   中英

CLLocationCoordinate2D to LocationList

Can I save the content of a CLLocationCoordinate2D array into a LocationList (Cloud Kit field type) ?

Here is what I've done, the TTitre is saved into the DB but not my CLLOcationCoordonate2D array

    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

Ok so I solved the issue : You can't save a CLLocationCoordinate array but only a CLLocation array. 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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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