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
181
votes
9 answers

Creating NSData from NSString in Swift

I'm trying to ultimately have an NSMutableURLRequest with a valid HTTPBody, but I can't seem to get my string data (coming from a UITextField) into a usable NSData object. I've seen this method for going the other way: NSString(data data: NSData!,…
Jackson Egan
  • 2,715
  • 4
  • 18
  • 26
41
votes
2 answers

How to print NSMutableURLRequest?

How to print NSMutableURLRequest using NSLog ?
31
votes
3 answers

NSMutableURLRequest not obeying my timeoutInterval

I'm POST'ing a small image, so i'd like the timeout interval to be short. If the image doesn't send in a few seconds, it's probably never going to send. For some unknown reason my NSURLConnection is never failing, no matter how short I set the…
kubi
  • 48,104
  • 19
  • 94
  • 118
15
votes
2 answers

Print NSMutableURLRequest Contents

I want to ask if anybody has ever tried printing out the values of a NSMutableURLRequest *request; Here's my scenario, I have formed my XML and tried sending it using Firefox Poster plugin, I am successful playing with valid and invalid contents, so…
mirageservo
  • 2,387
  • 4
  • 22
  • 31
12
votes
1 answer

Difference between setting an NSMutableURLRequest header and adding one

I was wondering what the difference between setting a header value and adding a header value to an NSMutableURLRequest is. Sounds sort of obvious but, for example, can't you just use addValue every time? Will setting a header that doesn't exist…
Danoram
  • 8,132
  • 12
  • 51
  • 71
11
votes
2 answers

Clearing Cookies for WKWebView on iOS 8.4

I'm building an app that uses Single Sign On for users to log in. After the user enters a successful ID and password, the web side of things returns headers which I grab and store in my app. The WKWebView also sets a cookie that the user…
Zack Shapiro
  • 6,648
  • 17
  • 83
  • 151
11
votes
4 answers

NSURLSessionDataTask timeout subsequent requests failing

I am creating a NSMutableRequest: self.req = [NSMutableURLRequest requestWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0]; The timeout is set to be 10 seconds because I don't want the user to wait too long to get…
nicky_1525
  • 929
  • 1
  • 10
  • 24
10
votes
3 answers

Losing cookies in WKWebView

When I create new request for WKWebView with authentication cookie and send the request, WKWebView correctly loads protected web page: let req = NSMutableURLRequest(URL: NSURL(string: urlPath)!) let headers =…
jiri.huml
  • 113
  • 1
  • 1
  • 8
9
votes
4 answers

When does -copy return a mutable object?

I read in Cocoa and Objective C: Up and Running that -copy will always return an immutable object and -mutableCopy will always return a mutable object: It’s important to know that calling -copy on a mutable object returns an immutable version. If…
rubergly
  • 878
  • 8
  • 20
8
votes
5 answers

Request to web service over SSL

i am struggling to request web service using https. I am getting this kind of error: An error occured : The certificate for this server is invalid. You might be connecting to a server that is pretending to be “SERVER_ADDRESS” which could put your…
Streetboy
  • 4,351
  • 12
  • 56
  • 101
7
votes
4 answers

How to remove headers in a NSMutableURLRequest?

How can I make a request that contains no headers fields? The requests are being sent to my own server implementation from scratch, which doesn't care about header fields. The request will at most contain only a post body. Let me know if I'm missing…
Gurpartap Singh
  • 2,744
  • 1
  • 26
  • 30
7
votes
0 answers

How to pass an access_token to YouTube API v3?

I'm trying to make an authorized call to YouTube Data API v3, as it's described here: https://developers.google.com/youtube/v3/docs/activities/list I got everything working fine, until I get to the part, where the access token is needed. I've added…
oleskii
  • 366
  • 3
  • 14
7
votes
1 answer

How to append something like ?id=1 to a NSMutableURLRequest

I want to display the data from this URL: http://www.football-data.org/soccerseasons/351/fixtures?timeFrame=n14 My baseURL is let baseUrl = NSURL(string: "http://www.football-data.org")!, so my request is let request = NSMutableURLRequest(URL:…
STheFox
  • 1,478
  • 4
  • 18
  • 24
7
votes
2 answers

Sending a POST request from Cocoa to Tumblr

This code snippet isn't working, I'm getting an "Authentication Failed." response from the server. Any ideas? NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: …
kubi
  • 48,104
  • 19
  • 94
  • 118
7
votes
1 answer

AFNetworking stopped working under iOS 6

I've noticed recently, that my code, that uses AFNetworking (latest version from master branch) stopped working properly under iOS 6. Here's my code: httpClient = [AFHTTPClient clientWithBaseURL:[NSURL…
1
2 3
24 25