Questions tagged [nsurlcomponents]

NSURLComponents (or URLComponents in Swift) is a type that parses URLs into and constructs URLs from their constituent parts.

For more information, see the official documentation of NSURLComponents.

26 questions
0
votes
1 answer

How can I remove the "&" that keep appearing when the URL is printed?

How can I remove the "&" that keep appearing when the URL is printed? Why is it even appearing? var url = URLComponents() url.scheme = "http" url.host = "api.openweathermap.org" url.queryItems = [ URLQueryItem(name: "/data",…
user10459086
0
votes
2 answers

How can I use a # symbol instead of ? in URLQueryItem?

If I create a URL like this: guard var urlComponents = URLComponents(url: "https://example.com/something", resolvingAgainstBaseURL: false) else { return } let queryItems = URLQueryItem(name: "token", value: token) …
0
votes
3 answers

how to convert host of nsurl to lowercase

Let's say I have www.GOOgle.com/....... I want to change it to www.google.com/.... and keep the rest of url as it is. I have tried with NSURLComponents, but it didn't work. // I am taking input from textfield and making the nsurl. …
backbencher
  • 89
  • 1
  • 8
0
votes
1 answer

Swift3 URL from URLComponents, how to add OR query items

Im constructing a URL from query items using URLComponents and I want to add some query items as OR conditions rather than AND. Im not sure what the proper terminology for this is. Anyway I would like the following,…
R.P. Carson
  • 409
  • 4
  • 18
0
votes
1 answer

How to get params value from POST request in swift

First I fire post request When user submit that form debugger area in inspect element shows the value of params. But How I will get that value in native ios Swift ? Can any one have idea ? Some what I know NSURLComponents used but I am confused how…
Malay
  • 1
  • 1
0
votes
2 answers

Share Text, Image and Url on Google+ without login

I would like to share Image with Url on Google+ without login on my iOS app. I have used : NSString *temp = @"Hello World"; // Construct the Google+ share URL NSURLComponents* urlComponents = [[NSURLComponents alloc] …
-1
votes
1 answer

URLComponents fails on 'path' part

What if path is more complex? How can I get URLComponenets get work is path is this? urlComponents.path = "v3/sandbox115e22c785254f36953c9f28337689bb.mailgun.org/message" unfortunatelly it fails here: guard let uriString =…
János
  • 27,206
  • 24
  • 130
  • 270
-1
votes
1 answer

Remove ? from query string swift 4

I have a url in which I add URL components to it to form a query string. For example the url is https://example.com/test, and with the url components the final url is https://example.com/test?urlcomponent1=1&urlcomponent2=1234. I need to keep the…
jfulton
  • 69
  • 10
-1
votes
2 answers

How to prevent URLComponents().port from adding a question mark before the query (Swift/Xcode)

I am trying to compose a representative URLComponents() in the app I am designing. Here is the code: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() var components = URLComponents() …
mansanto
  • 330
  • 2
  • 14
-1
votes
2 answers

Swift 4 How to remove %EF%BB%BF from URL created from URLComponent()?

I attempt to create URL from components var com = URLComponents() com.scheme = "http" com.host = "192.168.1.99" com.port = 77 com.path = "/api/dosomething/55" print("SHOW ME URl = \(com.url!))") What I got is something like…
-2
votes
1 answer

Avoid percent encoding of host in URLComponents

Using URLComponents, is there a way to avoid percent encoding of host? var components = URLComponents() components.scheme = "https" components.host = "endpoint.com/v1/api.php?" // ends up as https://endpoint.com%2Fv1%2Fapi.php%3F? but I want it to…
nambatee
  • 1,268
  • 12
  • 23
1
2