|
<< Click to Display Table of Contents >> Navigation: Forum > ios 11.4 cookies |
06-11-2018, 07:19 AM:
Is there a reason why this code to set cookies does not work in Safari on ios 11.4?
The code has been in production for some time running Intraweb ultimate 14.2.7 with SSL but recent reports suggest it no longer works for iPhone users. Does anyone here have insight or experience with this?
function GetCookieValue(sName: String): String;
begin
Result := WebApplication.Request.CookieFields.Values[sName];
end;
procedure SetCookie(CookieName, CookieValue: String; ExpireIn: Real);
var
ExpireOn: Real;
begin
if ExpireIn <> 0 then
ExpireOn := GetUTCDateTime + ExpireIn
else
ExpireOn := -1; // session cookie
WebApplication.Response.Cookies.Add(THTTPCookie.Create(CookieName, CookieValue, '/', ExpireOn));
end;
06-12-2018, 01:48 AM:
Maybe Apple decided that they need an iCookie now, and plain cookies won't work anymore... who knows? :-)
Please give a try with this code instead:
WebApplication.Response.Cookies.AddCookie();
BTW, you shouldn't calculate UTC time yourself. Different applications tread this differently (i.e. SA Indy, ISAPI, etc.). Is not guaranteed that your code will handle them all correctly. IW will convert when necessary. You just need to provide a DateTime value according to your server time.
Also, Apple has been changing cookie policy since iOS 11 release, restricting its usage. Are you sure that cookies are enabled on this specific device?