mercredi 28 décembre 2016

if statements leading to unresolved identifier

According to Xcode, the "query" in the cloud kit perform function alerts me that "query" is an unresolved identifier. I know this issue revolves around the if statements because this code works if "query" is clearly defined by one record type. However, I do not understand why query is unresolved in this situation, when all potential queries are accounted for.

 if newindex.row == 5
    {
        let query = CKQuery(recordType: "mexican", predicate: predicate)
    }
    if newindex.row == 6
    {
        let query = CKQuery(recordType: "seafood", predicate: predicate)
    }
    else if newindex.row == 7
    {
        let query = CKQuery(recordType: "steakhouses", predicate: predicate)
    }


    publicDB.perform(query, inZoneWith: nil)

Aucun commentaire:

Enregistrer un commentaire