在performQuery
另一个内部performQuery
被调用。两者的recordType
论点相同,但predicate
s 不同。
第二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)