-1
[CKRecord stringForKey :] : 인식 할 수없는 선택기 인스턴스 0x17412ece0 'Cloudkit, 인식 할 수없는 선택기
내가 위의 오류를 얻고있다, 나는 그것을 해결하기 위해 무엇을해야하는지 확실하지로 전송. CKAssets를 콜렉션 뷰로 반환하여 그림을 표시하는 쿼리를 실행 중입니다. 두 개의 텍스트 필드가 일치하도록하고, 이미지가 뷰를 채우는 데 연관된 이미지에 대해 수행하도록합니다. 누구든지 어떤 제안이 있습니까?
@IBOutlet var myCollectionView: UICollectionView!
let reuseIdentifier = "MyCell"
var matchedSelfie = [String]()
override func viewDidLoad() {
super.viewDidLoad()
let database = CKContainer.defaultContainer().publicCloudDatabase
let container = CKContainer.defaultContainer()
let publicDB = container.publicCloudDatabase
let data = CKRecord(recordType: "theUsers")
let text1 = data.valueForKey("text1")
let text2 = data.valueForKey("text2")
var predicate = NSPredicate(value: text1 === text2)
let myQuery = CKQuery(recordType: "theUsers", predicate: predicate)
var mySelfie = matchedSelfie
publicDB.performQuery(myQuery, inZoneWithID: nil) {
results, error in
if error != nil {
println(error)
} else {
for record in results{
if let aselfie = record.stringForKey("selfie") { //Optional binding
mySelfie.append(aselfie) //Append to string array
mySelfie.append(aselfie)
return()
}
}}}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
//#warning Incomplete method implementation -- Return the number of sections
return 1
}
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
//#warning Incomplete method implementation -- Return the number of items in the section
return matchedSelfie.count
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = myCollectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as CollectionViewCell
let image = UIImage(named: matchedSelfie[indexPath.row])
cell.matchedSelfie.image = image
// Configure the cell
return cell
}
좋습니다. 이전보기에서 오류가 발생했습니다. 클라우드 키트에 기록을 쓰지 않았습니다. 고맙습니다. –