dsk1306
dsk1306

Reputation: 129

Cloud Kit's performQuery in Swift 2.0


Hi. I'm trying to make Cloud Kit based app. For data fetch I'm using this

privateDatabase.performQuery(query, inZoneWithID: nil) {
        results, error in
        if error != nil {
            print(error)
        } else {
            print(results)
            for item in results {
                self.workoutData.append(item as! CKRecord)
            }
        }
    }

but XCode says

'[CKRecord]?' does not have a member named 'Generator'

Can you help me please?

Upvotes: 1

Views: 153

Answers (1)

brimstone
brimstone

Reputation: 3400

You need to unwrap the CKRecord array like so:

if let res = results {
    for item in res! {
        //Do things with item
    }
}

Upvotes: 1

Related Questions