2014-05-12 8 views
1

는이 코드를 실행합니다.
그러나 이러한 쿠키는 오래된 쿠키입니다.LoopJ AndroidAsyncHttp 및 영구 쿠키를 저장

또한 Activity에서 AndroidAsyncHttp 코드를 실행합니다. 동일한 오래된 쿠키가 전송됩니다.

그러나 현재 WebView에서 현재 쿠키를 인쇄 할 때 새로운 쿠키가 표시됩니다.

AndroidAsyncHttp에서 WebView의 쿠키를 보내려면 어떻게해야합니까?

답변

2

지우기 쿠키 전에 내가 그 CookieManager에 필요하지 않습니다 내 경험에 쿠키를

myCookieStore.clear(); 

을 설정합니다. 나는 이것을 단지 사용한다.

AsyncHttpClient myClient = new AsyncHttpClient(); 
PersistentCookieStore myCookieStore = new PersistentCookieStore(mContext); 
// clear cookie to make the fresh cookie, to ensure the newest cookie is being send 
myCookieStore.clear(); 
// set the new cookie 
myClient.setCookieStore(myCookieStore); 
myClient.get("http://example.com/mypage/", new AsyncHttpResponseHandler() { 
... 
} 
+1

문제는 WebView이고 AsyncHttpClient는 다른 쿠키 저장소를 사용합니다. AsyncHttpClient가 HTTP 요청으로 자체를 전송하기 때문에 이들 사이에 연결이 없습니다. – trante