A few days ago the project used the UIWebView, and in the Web page, the use of a multi-commented third-party. But when I posted a comment on the phone, there was no third-party cookie, and there was no such situation with Android, so I was looking for the reason. Looking for a long time did not find the reason. The first thought is that the cookie is not loaded, so the print Cookie,cookie exists, the cause of this error is overturned; is the cookie wrong? Tried to reset the cookie and so on, or not, tangled for a long time; then it is not UIWebView and Nsrequest which property settings allow all cookies to see all the documents about these two classes, or not find a workaround. So we re-brushed the problem, disabling the third-party cookie, is not related to the attributes of the cookie (forgiving seldom dealing with cookies, so there is no beginning to think about it), so in the cookie document to find the corresponding attributes, the class began to find this property.
/* ! @enum nshttpcookieacceptpolicy @abstract Values for the different cookie accept policies @constant Nshttpcookieacceptpolicyalways Accept All Cookies @constant nshttpcookieacceptpolicynever Reject All Cookies @constant nshttpcookieacceptpolicyonlyfrommaindocumentdomain Accept Cookies only from the main document Domain */typedef ns_enum (Nsuinteger, nshttpcookieacceptpolicy) { nshttpcookieacceptpolicyalways, Nshttpcookieacceptpolicynever, Nshttpcookieacceptpolicyonlyfrommaindocumentdomain};
See here become enlightened, set allow all cookies to load.
/* ! @method Cookieacceptpolicy @abstract The preference of the receiver of the cookie . */ @property nshttpcookieacceptpolicy cookieacceptpolicy;
Setting this property allows third-party cookies to be loaded.
Attached link to view: "Ios:is it possible to set a cookie manually using Sharedhttpcookiestorage for a UIWebView?"
IOS UIWebView allows all three-party cookies