Questions tagged [nsmutableurlrequest]

NSMutableURLRequest is a subclass of NSURLRequest provided to aid developers who may find it more convenient to mutate a single request object for a series of URL load requests instead of creating an immutable NSURLRequest for each load.

Information : NSMutableURLRequest Class Reference

370 questions
4
votes
1 answer

NSMutableURLRequest adding additional headers in url only for iOS 8

This is appears only on iOS 8. For earlier versions, it is fine. Examples: For iOS 7.1: NSString *url = @"http://www.example.com/api/search?name=test&page=1"; NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] init]; [urlRequest…
4
votes
1 answer

Change NSMutableURLRequest's default header

I need to change a default HTTP header "Connection" in NSMutableURLRequest to "close" value, instead of "keep-alive". What is the best practice to do it? I tried to use TCP level and create HTTP request myself + use GCDAsyncSocket. It works, but I…
Pavlo Shadov
  • 382
  • 4
  • 16
4
votes
2 answers

Is it possible to upload a file to server without converting it into NSData?

I am developing an app in which I have to upload a file to server from device, i know how to send file to server using following NSMutableURLRequest , but is it possible to store file to server without converting to NSData?? I have seen How upload…
user2265763
4
votes
1 answer

AFNetworking AFHTTPRequestOperation block is never called

I'm using AFNetworking to send a multipart form to a web-server, and i'm having some trouble with my AFHTTPRequestOperation. It's success and failure blocks are never called, after i start it. Here is my code (a resume of it) NSMutableURLRequest…
4
votes
2 answers

Base64 Encoding for NSString

I am trying to post the username and password to the server. I want to convert this username and password into Base64 Encoding. So this encoded string will be added for the Authorization field. Is there any API already available to do the Base64…
Cyril
  • 1,216
  • 3
  • 19
  • 40
3
votes
5 answers

Add fields to NSMutableURLRequest

How would I add key value pairs to the body of a NSMutableURLRequest? I know I could use something like this: NSURL *url = [[NSURL alloc] initWithString:@"http://localhost:8080/upload/"]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]…
nick
  • 2,833
  • 3
  • 34
  • 61
3
votes
1 answer

Using accept header with NSMutableURLRequest on iOS

I have a problem with my NSMutableURLRequest. My server supports both JSON and XML formats and they are separated with an access header. It also defaults to JSON if no access header is set. Which basically means that when I want the response in XML…
Lurk
  • 31
  • 1
  • 2
3
votes
2 answers

How do do the equivalent of the objective-C mutableCopy in Monotouch?

I have some code in objective-C which uses the 'mutableCopy' method to make a mutable copy of an NSURLRequest object called 'request': NSMutableURLRequest mutableRequest = [request mutableCopy]; How do I go about doing this in Monotouch? I tried…
3
votes
2 answers

Swift 3 NSMutableURLRequest second call fail

at all, I created a function that sends a "GET" request, to a amazon aws server, and gets a response in JSON, and then these data are placed in a table. When I first call this data, everything works perfectly, but when I get back to the home screen…
peppinoibra
  • 139
  • 1
  • 10
3
votes
2 answers

Sending images as part of form data from an iPhone

I've managed to get simple text data sent to a server using this code: NSMutableString *parameterString = [[NSMutableString alloc] initWithString: @""]; [parameterString appendString:@"name=steve&"]; [parameterString…
cannyboy
  • 24,180
  • 40
  • 146
  • 252
3
votes
1 answer

Curl command to NSURLRequest Swift

I was converting the following curl command: curl -X PUT -H "Authorization: Bearer 34kjsfhjbdjkh.jdhfds334jdshfksfs.kkjkjdsakjsd" -d "current_pwd=oldpassword&new_pwd1=newpassword&new_pwd2=newpassword" localhost:3000/updateDetails into a…
Siddharthan Asokan
  • 4,321
  • 11
  • 44
  • 80
3
votes
0 answers

How to call multiple rest api one by one in loop

I am trying get data from server to store locally when needed. The data is present at different api urls. I want to call all those apis on a single refresh click.Kindly help me to solve this. -(void) call:(NSString *)url{ NSURLRequest…
vaibhav
  • 4,038
  • 1
  • 21
  • 51
3
votes
2 answers

How to upload an image with json?

I am trying to upload an image with json data. I just followed the post and implemented the mechanism. But I get the error { status code: 400, headers { "Cache-Control" = "no-cache, no-store, max-age=0, must-revalidate"; Connection =…
iOS
  • 3,526
  • 3
  • 37
  • 82
3
votes
3 answers

NSURLCache - Disk caching for GET request with parameters not working

I'm trying to cache some HTTP requests to disk using NSURLCache. After doing some tests with AFNetworking and not working, I created a simple example using NSURLRequest. I initialize the cache on the AppDelegate like this, setting the memory size to…
jcardenete
  • 1,646
  • 3
  • 13
  • 16
3
votes
5 answers

NSMutableURLRequest with parameter - cannot parse response

I am trying to create a connection to a URL that prints out JSON code that is then parsed and processed. My URL has a parameter called bypass. The URL looks like this: http://www.getchanged.net/json.asp?bypass=MIGCBgkrBgEEAYI3WAOxxx I did not manage…
nimrod
  • 5,595
  • 29
  • 85
  • 149
1 2
3
24 25