I am getting the error 'AnyObject' does not have a member named 'append' for results that I am trying to post to an array. I'm not sure how to fix the error, as I thought my code was correct. Can someone help me make the proper adjustments? My code is as follows:
import CloudKit
import UIKit
import Foundation
class Items {
var theSelfie: [String]
init(record: CKRecord) {
println("init")
var record: CKRecord
var iama: String
var youarea: String
var image: CKAsset? // tried also initializing the CKAsset separately
var postPic: UIImage?
let database = CKContainer.defaultContainer().publicCloudDatabase
let container = CKContainer.defaultContainer()
let publicDB = container.publicCloudDatabase
let data = CKRecord(recordType: "theUsers")
var predicate = NSPredicate(value: true)
let myQuery = CKQuery(recordType: "theUsers", predicate: predicate)
var mySelfie = theSelfie
publicDB.performQuery(myQuery, inZoneWithID: nil) { results, error in
if error != nil {
println(error)
} else {
for record in results{
let aselfie = data.objectForKey("selfie")
aselfie.append[mySelfie]()
return ()
}
}
}
}
}
}
append[mySelfie]? Why are there brackets? What isCKRecord?