mardi 14 juin 2016

HOW CAN I GET RECORD ID FROM CKReference List in CloudKit


I have this 2 case:

1) Reference attribute on schema

let userReference = user!["friend"] as! CKReference
print(userReference.recordID)

2) Reference List attribute on schema

let userReferenceList = user!["friends"] as! [CKReference]
print(userReferenceList)

In the first one the console print the recordID and there is no problem. In the second the console print all the things but I can't put userReferenceList.recordID

If I code as! CKReference and not as ! [CKReference] I can code userReferenceList.recordID method but app crashes.


Aucun commentaire:

Enregistrer un commentaire