- Home /
Webclient headers not adding in iOS build
Hello all. I have to add headers to a webclient async request and everything seems to work in the editor, but whenever I create a build for a device (iOS) the header don't seem to "stick" for the native requests. For example I do this:
private static readonly string headerKey = "123456789";
public static WebClient client;
public static void DownloadString()
{
using(client = new WebClient())
{
client.Headers.Add("Authorization", headerKey);
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCallback);
client.DownloadStringAsync(new Uri(nextURL));
}
}
public static void DownloadStringCallback(object sender, DownloadStringCompletedEventArgs args)
{
//Do stuff
}
And this all works fine in the editor. I can get a response to the DownloadStringCallback function and the args parameter contains a valid args.Result
I know this is a problem with the headers being added because I get a response on device but it is a null result. The headers act as a key for a reverse proxy that we have set-up, and when I hit our endpoint directly with a device build I get valid responses just like in the editor.
Is this just a problem with Unity's translation of a WebClient request into a native iOS request?
If so can I accomplish the same async functionality with another request class? I'm thinking of HttpWebRequest but I don't know if I am going to have the same problems.
Answer by superdev · Jun 07, 2013 at 12:18 AM
This actually fixed my problem: http://answers.unity3d.com/questions/250803/executionengineexception-attempting-to-jit-compile.html
I had to choose 2.0 subset
Your answer
Follow this Question
Related Questions
Is Pro really required for plugins on iOS? 1 Answer
Catching DLLImport errors 1 Answer
Pro feature 0 Answers
Unity Pro with free iOS and Android? 1 Answer
Downloading file using web client not working in all servers 0 Answers