1

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
}
4

0 回答 0