I've got an iPad app with a UIWebView in it, and need it to accept cookies via calls from JavaScript. It seems to not accept new cookies, even after explicitly setting the 'cookieAcceptPolicy' of NSHTTPCookieStorage to 'always'.
I saw one other unanswered question on this suggesting the problem might be related to iOS 4.2: http://groups.google.com/group/phonegap/browse_thread/thread/81bc91bdbfe7bf7b
Can anyone confirm that UIWebView accepts cookies >= iOS 4.2.1?
Also, here is the javascript that tries to set the cookie:
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
Called by:
setCookie("ReferrerValue",document.URL,365);
I guess if this can't work I'll need a way to do it Objective-C but that is a whole other question. Thank you.