Questions tagged [nsurlsessiontask]

55 questions
1
vote
0 answers

NSURLSession keeps giving errors like 1001, 1003, 1005 etc

I have recently moved from NSURLConnection to NSURLSession i.e., I have replaced all implementations of NSURLConnection with NSURLSession. I have done this so that my code is up to date. Everything works fine except that I now keep getting a lot of…
1
vote
3 answers

How to get data to return from NSURLSessionDataTask in Swift

I have this same question as was asked and answered here: How to get data to return from NSURLSessionDataTask The difference: How can I do this in Swift? I do not know Objective C at all so trying to interpret that answer is proving a bit futile…
TResponse
  • 3,940
  • 7
  • 43
  • 63
1
vote
1 answer

How can I log each request/response using AFHTTPSessionManager?

I'm migrating my project to AFNetworking 2.0. When using AFNetworking 1.0, I wrote code to log each request/response in the console. Here's the code: -(AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request …
hgwhittle
  • 9,316
  • 6
  • 48
  • 60
1
vote
1 answer

Returning directory listing with PHP

I am using the following to return the listing of all text files on my server. echo json_encode(glob("*.{txt}", GLOB_BRACE)); The issue I am having is when I execute this php file from my app, with only one text file in the directory, it returns…
0
votes
0 answers

Swift : Track group of API calls to show progress bar

I have collection view with 6 cells - each cell makes 3-4 different API calls . I want to show collective progress bar below navigation bar . How to keep track of api calls to generate progress from them ? PS: API calls don't have any download or…
Akash Shindhe
  • 558
  • 4
  • 16
0
votes
1 answer

Execute swift nsurlsession Tasks in serial order

I don’t know how to execute multiple NSUrlSession tasks one by one. When first task finishes start second task, when second task finishes start third task etc For example I want to download multiple files from a web service. I want them to begin…
0
votes
1 answer

Advantage of wrapping NSURLSessionTask inside iOS NSOperations

Could any one please tell me what is the real advantage gained by using NSURLSessionTask inside NSOperation while making http network calls in iOS? We can get the abstraction by wrapping NSURLSessionTask inside any other plain custom class e.g…
0
votes
1 answer

Can a URLSessionStreamTask be used for both reading and writing?

In the startLoading method of my URLProtocol subclass, I create a URLSession and URLSessionStreamTask. I resume the task and add a BlockOperation to call my first transaction method. That method uses URLSessionStreamTask.write. If I don't get an…
CTMacUser
  • 1,996
  • 1
  • 16
  • 27
0
votes
2 answers

Why did writing with URLSessionStreamTask time out?

I'm practicing making a URLProtocol subclass. I'm using URLSessionStreamTask to do the reading & writing. When trying out the subclass, I got a time-out. I thought I messed up my reading routine, but adding logging showed I didn't get past the…
CTMacUser
  • 1,996
  • 1
  • 16
  • 27
0
votes
1 answer

Is there any solution to pause NSURLSessionTask when iPhone goes to sleep and resume when iPhone becomes active

I am performing some NSURLSessionTask. It takes nearly 10-15 seconds to complete the task.Everything goes well when iPhone is in active state. The problem here is while performing the task, if iPhones goes to sleep mode then task will stop with an…
0
votes
1 answer

NSURLSessionTask Never Calls Back When WiFi Off

When I turn off my WiFi connection and run the following code on the iPhone 6s 10.2 simulator, the callback is never executed. I expected the callback to fire fairly quickly with an error like "No Internet…
bendytree
  • 13,095
  • 11
  • 75
  • 91
0
votes
2 answers

NSURLSessionResponseCancel produces error?

I used NSURLConnectionobject and called its method cancel sometimes. Now I should replace NSURLConnection -> NSURLSession. NSURLSession operates with tasks which have cancel method too. The problem is -[NSURLConnection cancel] just stop the handling…
Vyachaslav Gerchicov
  • 2,317
  • 3
  • 23
  • 49
0
votes
0 answers

Replace NSURLConnection+delegate with NSURLSession+delegate?

First of all there a lot of similar questions but they are all about creating of NSURLSessionDataTask with completion handler. In my case I have NSURLConnection with a lot of delegate methods and I need to replace it with NSURLSession. According to…
0
votes
0 answers

When i am trying to send data in post method NSUrlSessionTask i am getting this error?

Error: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not…
Kishore Kumar
  • 4,265
  • 3
  • 26
  • 47
0
votes
1 answer

How to prevent resume the duplicate NSURLSessionTask

I'm trying to use NSURLSession in my project. And here is the situation, I want to check is there any task with the same request already exist. So I use getTasksWithCompletionHandler to check, if there is not, then resume the task in the block. but…
funclosure
  • 498
  • 6
  • 15