nsurlsessionconfiguration

NSURLSessionConfiguration timeoutIntervalForRequest doesn't seem to work with the background session

允我心安 提交于 2019-12-08 00:40:39
问题 The new timeout property of NSURLSessionConfiguration doesn't seem to work when the session is set to work in background (via backgroundSessionConfiguration call). Anybody know if that's really the case? Code snippet: NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration backgroundSessionConfiguration:bgSessionConfigIdentifier]; sessionConfig.HTTPMaximumConnectionsPerHost = 1; sessionConfig.timeoutIntervalForRequest = 60; Do I need to do anything extra for the timeout to work?

AFHTTPSessionManager posting video swift

痞子三分冷 提交于 2019-12-06 12:31:20
问题 I am trying to upload a video in background using AFNetworking > AFHTTPSessionManager Post method. I want it to conitune uploading even if the app is suspended. But I get error while executing this code, it logs no error, and points to nowhere in code. I tried every solution available on other posts regarding my scenario, but couldn't get it working. Plesae check my code below and suggest me solution or link me somewhere to make it work { let urlString = BaseUrl + WebLinks.post let appId =

NSURLSessionConfiguration timeoutIntervalForRequest doesn't seem to work with the background session

落花浮王杯 提交于 2019-12-06 12:31:06
The new timeout property of NSURLSessionConfiguration doesn't seem to work when the session is set to work in background (via backgroundSessionConfiguration call). Anybody know if that's really the case? Code snippet: NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration backgroundSessionConfiguration:bgSessionConfigIdentifier]; sessionConfig.HTTPMaximumConnectionsPerHost = 1; sessionConfig.timeoutIntervalForRequest = 60; Do I need to do anything extra for the timeout to work? I just ran into similar problem, fixed it by using timeoutIntervalForResource instead of

NSURLSessionConfiguration HTTPAdditionalHeaders not set

拜拜、爱过 提交于 2019-12-05 06:04:43
Authorization header is set in NSURLSessionConfiguration , however it is not attached to NSURLSessionDataTask . Is this a bug in Foundation framework ? NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; [configuration setHTTPAdditionalHeaders:@{@"Authorization":@"123"}]; // Initialize session with NSURLSessionConfiguration NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; NSURLSessionDataTask *sessionTask = [session dataTaskWithRequest

AFHTTPSessionManager posting video swift

半腔热情 提交于 2019-12-04 19:18:51
I am trying to upload a video in background using AFNetworking > AFHTTPSessionManager Post method. I want it to conitune uploading even if the app is suspended. But I get error while executing this code, it logs no error, and points to nowhere in code. I tried every solution available on other posts regarding my scenario, but couldn't get it working. Plesae check my code below and suggest me solution or link me somewhere to make it work { let urlString = BaseUrl + WebLinks.post let appId = NSBundle.mainBundle().bundleIdentifier let config = NSURLSessionConfiguration

unable to upload file using NSURLSession multi-part form data in iOS

被刻印的时光 ゝ 提交于 2019-12-04 00:04:11
I am trying to upload a video / image file using - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL; method using multi-part form data. But somehow i am not able to upload the file and i am getting " stream ended unexpectedly " error. Requirements Upload a video / image file to server App should support background uploads (Continue the upload process even after app goes into background) Server expects the data to be sent using multi-part form data. Methods / API's used to achieve this NSURLSession background session API (Complete code listed

How to upload task in background using afnetworking

a 夏天 提交于 2019-12-03 12:31:46
I'm trying to upload large files using AFNetworking and have the upload continue when the application is in the background. I can upload files just fine, but when I attempt to use a background configuration -- the application crashes with the following stacktrace: Exception: EXC_BAD_ACCESS (code=1, address=0x8000001f)) _CFStreamSetDispatchQueue -[__NSCFBackgroundDataTask captureStream:] __70-[__NSCFBackgroundDataTask _onqueue_needNewBodyStream:withCompletion:]_block_invoke_2 _dispatch_call_block_and_release _dispatch_queue_drain _dispatch_queue_invoke _dispatch_root_queue_drain _dispatch

NSURLSessionDownloadTask keeps retrying when using Background Configuration

我只是一个虾纸丫 提交于 2019-12-03 09:53:23
问题 I have a problem when it comes to a slow backend and downloading data with background configuration. NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration backgroundSessionConfiguration:identifier]; _backgroundSession = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil]; NSURLSessionDownloadTask *downloadTask = [_backgroundSession downloadTaskWithURL:URL]; [downloadTask resume]; If the connection is astablished but it takes more than 60

NSURLSessionTask never calls back after timeout when using background configuration

耗尽温柔 提交于 2019-12-03 05:47:17
问题 I am using NSURLSessionDownloadTask with background sessions to achieve all my REST requests. This way I can use the same code without have to think about my application being in background or in foreground. My back-end has been dead for a while, and I have taken that opportunity to test how does NSURLSession behave with timeouts. To my utter surprise, none of my NSURLSessionTaskDelegate callbacks ever gets called. Whatever timeout I set on the NSURLRequest or on the NSURLSessionConfiguration

NSURLSessionTask never calls back after timeout when using background configuration

末鹿安然 提交于 2019-12-02 19:08:57
I am using NSURLSessionDownloadTask with background sessions to achieve all my REST requests. This way I can use the same code without have to think about my application being in background or in foreground. My back-end has been dead for a while, and I have taken that opportunity to test how does NSURLSession behave with timeouts. To my utter surprise, none of my NSURLSessionTaskDelegate callbacks ever gets called. Whatever timeout I set on the NSURLRequest or on the NSURLSessionConfiguration , I never get any callback from iOS telling me that the request did finish with timeout. That is, when