Questions tagged [urlrequest]

247 questions
3
votes
4 answers

How to play a sound in Actionscript 3 that is not in the same directory as the SWF?

I have a project with a bunch of external sounds to a SWF. I want to play them, but any time I attempt load a new URL into the sound object it fails with either, Error #2068: Invalid Sound or raises an ioError with Error #2032 Stream Error //…
tronster
  • 113
  • 2
  • 2
  • 9
2
votes
1 answer

Can't set "Content-Type" for URLRequest in as3

I'm trying to set Content-Type for URLRequest headers to "application/json". Here is the code: var request:URLRequest = new URLRequest("http://localhost"); request.contentType = "application/json; charset=UTF-8"; But as you can see on screenshot…
Andrei
  • 571
  • 6
  • 15
2
votes
1 answer

swift add ssl certificate to URLRequest

I'm trying to control my Phillips hue lights from my app. Anyway they have an Api where we can control all of that. The issue is that on the software Postman (to test) they say to disable "SSL Certificate Verification". When I try to call with…
Antoine
  • 21
  • 3
2
votes
0 answers

URLRequest.addValue() causes SwiftUI calendar to revert date

The function below is called every 3 seconds and looks like: func fetchItems(){ let url = URL(string: itemUrl)! var request = URLRequest(url: url) request.httpMethod = "GET" request.addValue("Item \(self.item)", forHTTPHeaderField:…
nickcoding
  • 305
  • 8
  • 35
2
votes
1 answer

Pattern cannot match values of type 'URLRequest'

I am trying to upload an image in Alamofire parameters. But I keep getting this error that wont let me compile. I am using swift 5. Error let image = profilePictureView.image! let imageData =…
Sarmad
  • 21
  • 2
2
votes
1 answer

JSON Decoder fails with URLSession

Pretty new to Swift and trying to learn SwiftUI this week. Attempting a GET request from a Joke API and eventually looking to get it to refresh every time you press a button. I have a feeling I'm defining my structs incorrectly or maybe not decoding…
2
votes
4 answers

JSON request from swift showing empty array in php

I am trying to make a request to a PHP server from my swift app. For some reason php is showing an empty array as the $_REQUEST variable. I have looked through stack overflow and implemented everything I can find that might help, but still getting…
Neglected Sanity
  • 1,770
  • 6
  • 23
  • 46
2
votes
1 answer

URLRequest fails before timeout

I want to set different timeouts for different requests. My request routine looks like: var request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: timeout) //…
Valentin Shamardin
  • 3,569
  • 4
  • 34
  • 51
2
votes
2 answers

URL Encoding a string with special characters

Please consider below code that I implemented in my iOS App: let kBaseURL = "https://www.sampledomain.com/" let method = "api/MasterData/GetCompanyList?jsonArgs={\"AccountID\":%d}" private func prepareURL(api: String) -> String { return…
Satyam
  • 15,493
  • 31
  • 131
  • 244
2
votes
1 answer

Convert CURL to URLRequest

I’m trying to converting the the following curl request Swagger gives me to URLRequest: curl -X GET --header 'Accept: application/json' --header 'Authorization: key ttn-account-v2.' …
ChrisTheGreat
  • 512
  • 4
  • 21
2
votes
0 answers

Swift 4: Multiple network request on Linux

I'm trying to make a network request multiple times and I'm facing with error core dumped error on linux (macOS its ok). Either request1() or request2() are aborted import Foundation import Dispatch func request2() { for i in 1...5 { …
Klevison
  • 3,342
  • 2
  • 19
  • 32
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
0 answers

How to HTTP-CONNECT with an URLRequest in Swift

I want to establish a TCP tunnel through an HTTP(S) proxy with high level APIs, i.e. URLRequest provided by iOS/macOS SDKs in Swift with the HTTP CONNECT command. I have the following code, assuming the proxy runs on localhost:8080: import…
Max
  • 1,387
  • 1
  • 15
  • 29
2
votes
0 answers

I'm trying to send a POST request with Alamofire 4.0 & Swift 3, but the server receive GET parameters

I'm trying to make a request sending parameters by POST, Alamofire request says that its POST, but my server get the parameters by GET. let formParams:[String : String] = ["facebook_id": COUtils.userProfile["id"]!, "full_name": name, "email":…
Patricio Bravo
  • 406
  • 6
  • 8
2
votes
1 answer

Upload a picture to cloudinary using the REST API

We are developing an App using AIR/AS3 and would like to upload a picture to cloudinary via the REST API from the client, instead of using Node.js. Reading the Documentation of cloudinary, we have found that it should be done via a HTTP/S POST…
GV3
  • 491
  • 3
  • 16
1 2
3
16 17