on iOS , NSURLRequest objects represent a URL load request in a manner independent of protocol and URL scheme. NSURLRequest encapsulates two basic data elements of a load request: the URL to load, and the policy to use when consulting the URL content cache made available by the implementation.
Questions tagged [nsurlrequest]
1095 questions
2
votes
0 answers
willPerformHTTPRedirection not called
I use next code to create session and run task:
NSURLSessionConfiguration * config = [NSURLSessionConfiguration defaultSessionConfiguration];
self.session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil];
NSURL *url =…

Viktorianec
- 361
- 6
- 22
2
votes
1 answer
Swift random 400 errors when making URLRequest
I am attempting to interact with an API. The service usually works and returns a 200 response but will occasionally respond with a 400 error and only a blank headers in the debug description. I have made a recursive function to attempt to pass the…

Sean Cook
- 435
- 7
- 21
2
votes
2 answers
block ads from url loaded in WKWebView
I am loading url in webView and now I want to block ads from url in webView. How can I achieve this?
[_webVw loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:page_url]]];

Shah Paneri
- 729
- 7
- 28
2
votes
3 answers
iPhone Objective C oauth 2.0 Login - unsupported_grant_type
I am brand new to salesforce development and am trying to connect to Salesforce to get the token.
I guess my question is 2 fold:
1) Do I have to use a webpage to authenticate with SF?
2) If not, why is this not working? When I try to use the…

smcdrc
- 1,671
- 2
- 21
- 29
2
votes
1 answer
Wait response before proceeding
I'm working to an iOS Swift App and I am trying to get the content of a website. The problem is that, when I run the code, the response object is returned after other lines are executed.
I have this:
public var response: Array?
public func…

JackDevelop
- 23
- 1
- 4
2
votes
4 answers
Should I use CharacterSet or URLQueryItem?
I have some problem when try to call a url string request with some special character inside. For example with CharacterSet, when in URL have the %20 that mean spacebar and I use the addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)…

Huy Nguyen
- 77
- 1
- 12
2
votes
1 answer
Request working properly with postman but fails with protocol error when requesting with iOS
I am trying to run this request and the reason I am doing is that from here is that I want to test push notifications (I mean a lot of them) with different strings in a loop.
When I try to do it with Postman it works perfectly fine I mean I had…

user3745635
- 847
- 1
- 8
- 21
2
votes
1 answer
How to use NSURLRequest and NSURLConnection over a secure connection? (HTTPS)
I'm using NSURLRequest and NSURLConnection to send web requests to a webserver with a valid ssl certificate. Is there anything special I need to do other than setting the url as https vs. http to get it to use ssl?

Randall
- 14,691
- 7
- 40
- 60
2
votes
2 answers
A better way to create the body of a NSMutableURLRequest
I'm new to objective-c and am wondering if there is a better way that the following to create the HTTP POST body that the method I have below.
- (NSData*) generateBody: (NSDictionary*) requestParams {
NSMutableData *body = [[[NSMutableData alloc]…

benshort
- 670
- 8
- 14
2
votes
1 answer
Authorization Header in Swift POST
My app creates POST request with Authorization header - it looks like :
let accessToken = "veryCoolToken"
var request = URLRequest(url: myURL)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField:…

moonvader
- 19,761
- 18
- 67
- 116
2
votes
1 answer
NSUrlRequest works in simulator but not on iphone
I have an app which records sound from microphone and then sends it to my website through NSUrlRequest. To test it, I added that audio is played from website so I can hear if it worked.
When I test it on simulator, everything works fine: audio is…

kvetinac97
- 61
- 5
2
votes
2 answers
Cocoa File Upload with Progress Bar
(This is really a double-whammy in terms of questions, since there really is two serperate questions, but they kinda belong together.)
First Question:
How would I go about uploading a file (I have an NSData object containing the file's contents…

Tristan
- 3,058
- 6
- 40
- 68
2
votes
1 answer
Making call to Google Cloud Natural Language API using Swift 3.0
I'm trying to form my request to Google's Cloud Natural Language API based on this code https://cloud.google.com/natural-language/reference/rest/v1/documents in Swift, but I can't quite get the syntax right?
import Foundation
import…

GarySabo
- 5,806
- 5
- 49
- 124
2
votes
0 answers
The Error Response Data Retrieval from Server
The basic functions of connection.
+ (NSMutableURLRequest*)downloadUrl:(NSString*)baseURL Myurl: (NSString*)myurl Params:(NSString*)params{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", [self mobileURL], myurl]];
…
2
votes
1 answer
canOpenURL: Always Fails
I'm always getting this response even I already add it to my LSApplicationQueriesSchemes
LSApplicationQueriesSchemes
fbapi
fb-messenger-api
fbauth2
…

Alvin John
- 403
- 4
- 14