CKContainer's
performQuery
メソッドは深さ優先検索として再帰的に呼び出され、5 番目のレベルでは戻りません。どうすればいいですか、なぜそれが起こるのですか?スレッドのスタックの深さに関する CloudKit の制限ですか? それに関するドキュメントはありますか?似たような人に会ったことがありますか?
func sth() {
// init here entityName, predicate..
publicDatabase.performQuery(CKQuery(recordType: entityName, predicate: predicate), inZoneWithID: nil, completionHandler: {records, error in
if error == nil { //at 5th level neither this line ..
let temporaryContext = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
temporaryContext.parentContext = Utility.managedObjectContext()
temporaryContext.performBlockAndWait({
sth()
})
} else {
println(error.localizedDescription)
}
dispatch_semaphore_signal(sema)
})
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER)
println("log 2") // nor that line is get reached
}