内部でperformQuery
他の人performQuery
が呼び出されています。recordType
どちらも引数は同じですが、spredicate
が異なります。
2 番目performQuery
は返されず、アプリは実行され、CloudKit が応答するのを待ちます。
擬似コードは次のようになります。
publicDatabase.performQuery(CKQuery(recordType: recordTypeSrc, predicate: predicate), inZoneWithID: nil, completionHandler: {records, error in
if error == nil {
//.. problem is not name collision or reusing the same parameter, coming codepart is called though other methods
publicDatabase.performQuery(CKQuery(recordType: recordTypeSrc, predicate: predicate2), inZoneWithID: nil, completionHandler: {records, error in
//THIS LINE WILL NEVER GET REACHED
if error == nil {
} else {
println(error.localizedDescription)
}
dispatch_semaphore_signal(sema2)
})
dispatch_semaphore_wait(sema2, DISPATCH_TIME_FOREVER)
//..
} else {
println(error.localizedDescription)
}
dispatch_semaphore_signal(sema)
})
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER)