2017-05-10 81 views
1

暫停NSURLSessionDataTask後,我的init NSURLSessionDataTask與跟蹤方法仍然超時我在AFN3.1.0

- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; 

然後調用setDataTaskDidReceiveResponseBlocksetDataTaskDidReceiveDataBlock將數據寫入到文件。 然後我打電話suspend,但在timeoutInterval後我得到了帶有超時錯誤的completionHandler。

文件有關暫停: /* * Suspending a task will prevent the NSURLSession from continuing to * load data. There may still be delegate calls made on behalf of * this task (for instance, to report data received while suspending) * but no further transmissions will be made on behalf of the task * until -resume is sent. The timeout timer associated with the task * will be disabled while a task is suspended. -suspend and -resume are * nestable. */

我想知道如何停止的任務,爲什麼我叫暫停這樣它不工作

回答

0

它也發生在我身上。我做了幾個測試,看起來AFN沒有任何問題,你可以掛起一個NSURLSessionDownloadTask,而不是NSURLSessionDataTask。我不知道原因。我發現這個職位:NSURLSessionTask. Suspend does not work

相關問題