CloudKit如何处理递归操作?

时间:2014-09-10 07:52:46

标签: ios recursion cloudkit

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
}

0 个答案:

没有答案