nsurlsessiondownloadtask

Swift: How to catch disk full error on background URLSession.downloadTask?

不羁岁月 提交于 2021-01-28 13:38:16
问题 I'm struggling to understand what I thought would be easy. I have a URLSession.downloadTask. I have set my downloading object as the URLSession delegate and the following delegate methods do receive calls, so I know my delegate is set correctly. func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) func urlSession(_ session: URLSession, downloadTask:

urlSession download from remote url fail - CFNetworkDownload_gn6wzc.tmp appeared

自作多情 提交于 2020-12-15 04:56:40
问题 I was trying to download file from remote url using urlSession . But when the download is completed an unexpected file appeared named CFNetworkDownload_gn6wzc.tmp then i cannot open that file using uidocumentinteractioncontroller. What is that file? how to fix this issue. Thank for reply. Here is message Your location is file:///Users/pisal/Library/Developer/CoreSimulator/Devices/26089E37-D4EA-49E5-8D45-BB7D9C52087D/data/Containers/Data/Application/767E966E-5954-41BA-B003-90E2D27C5558/Library

nsurlsession for multiple request in loop

北慕城南 提交于 2020-01-05 08:42:09
问题 I have been trying to download image/txt but i need to do it until that url exists & download that image/txt file,so i keep calling same method again & when i set debug point i see this . If url is right than i do not see any queue in debug navigator because it is not calling method again. i referred AFNetworking library to the same but i guess it`s working in same way as i am doing in NSURLSession,right? Case:- I check for url if exists or not, so if it`s exists than load both urls(time.txt

nsurlsession for multiple request in loop

我怕爱的太早我们不能终老 提交于 2020-01-05 08:41:57
问题 I have been trying to download image/txt but i need to do it until that url exists & download that image/txt file,so i keep calling same method again & when i set debug point i see this . If url is right than i do not see any queue in debug navigator because it is not calling method again. i referred AFNetworking library to the same but i guess it`s working in same way as i am doing in NSURLSession,right? Case:- I check for url if exists or not, so if it`s exists than load both urls(time.txt

NSURLSessionDownloadTask issues with Storage almost full disk warnings

痴心易碎 提交于 2020-01-04 14:05:29
问题 I'm having issues with handling "out of space" / "full disk" errors on ios with NSURLSessionDownloadTask If the disk is full due to downloads done in the app I get a call to URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) with the error having domain NSPOSIXErrorDomain and error code ENOSPC But this only happens once for a task, not for all running Ex: If I have 3 tasks running at the time, I only get this for one of them and the other 2 remain

What is the time delay between getting data and loading to UITableView

杀马特。学长 韩版系。学妹 提交于 2019-12-25 06:26:39
问题 I'm loading my UITableView from an Api call but although the data is retrieved fairly quickly, there is a significant time delay before it is loaded into the table. The code used is below import UIKit class TrackingInfoController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet var table : UITableView? @IBOutlet var indicator : UIActivityIndicatorView? @IBOutlet var spinnerView : UIView? var tableArrayList = Array<TableData>() struct TableData { var dateStr:String = "

Downloading images in UITableViewCell: Data vs URLSession?

你。 提交于 2019-12-24 08:46:38
问题 I have a UITableView and I need each of its cells to download an image from a provided URL and show it. This looks to be a quite common scenario and indeed I found several posts and questions related to this, but I am not still clear about which the best approach should be. First one, I have one using Data(contentsOf:) . This is the code I have in my UITableViewCell : class MyCell: UITableViewCell { @IBOutlet weak var activityIndicator: UIActivityIndicatorView! @IBOutlet weak var imageView:

Download all available (and new) files

拥有回忆 提交于 2019-12-23 06:25:07
问题 I'm using NSURLSessionDownloadTask to download some .mov files from a web and storing them in my app. Now what I'd like to achieve is to download ALL files of certain type (in this case .mov) available on the page, without having to specify every file URL download files ONLY if they are not already stored in my app. Is there any way to achieve this? 回答1: You would have to scrape that html page to get all the urls (.mov) you are looking for. Either you can use NSXMLParser if you want to write

Background transfer download task failed when app was closed

我的梦境 提交于 2019-12-22 11:20:02
问题 I have created background nsurlsession to perform download task. It worked well when the app was in background. However, download task seems to be canceled and failed when I closed the app (double click "Home" button and swipe up), and it made me to download from the beginning again when I relaunched the app. According to Apple document, background transfer works even the app is no longer running. Am I doing anything wrong? 回答1: From the NSURLSessionConfiguration Class Reference: If an iOS

NSUrlSessionDownloadTask - didCompleteWithError when go in background

Deadly 提交于 2019-12-18 16:49:39
问题 When I force my device to go in sleep mode by pressing the power button, my background task stops by calling the delegate method didCompleteWithError with the error : The operation couldn’t be completed. Operation not permitted How can I configure my NSURLSession to continue the download even in sleep mode? Is it even possible? If not, what options do I have? I need to download a file of 300Mb, so with a low connection the application will go in sleep mode before the end of the download. Here