Hi guys,
We have php sessions set up in my team's game but we're having problems deleting/purging cookies after receiving them and setting them in our database controller. The Unity Editor doesn't seem to cache these but it's an issue in iOS.
I'm using the new network api (UnityWebRequest). This is how I'm setting my cookies:
WWWForm form = new WWWForm ();
form.AddField ("data", userData.data);
UnityWebRequest www = UnityWebRequest.Post(url, form);
www.SetRequestHeader("Cookie", sessionCookieString);
yield return www.Send();
...
www.Dispose();
And this is how I retrieve the initial one on logon:
...
//try to get a cookie
if(www.GetResponseHeaders().ContainsKey("SET-COOKIE"))
{
string result;
if(www.GetResponseHeaders().TryGetValue("SET-COOKIE", out result)) {
...
If I try getting the cookies at a later point and deleting them, I get a null exception in the Editor. It's possible this doesn't happen in iOS as I haven't tested it yet.
UnityWebRequest www = new UnityWebRequest();
//null exception
www.GetResponseHeader("SET-COOKIE").Remove(0);
www.GetRequestHeader("Cookie").Remove(0);
Any thoughts?
↧