Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

登录状态的同步 #15

Closed
cww1987521 opened this issue Feb 26, 2019 · 4 comments
Closed

登录状态的同步 #15

cww1987521 opened this issue Feb 26, 2019 · 4 comments

Comments

@cww1987521
Copy link

楼主,我先打开一个web页面作为tab的第一个页面,随后再通过第二个web页面登录成功,如何让第一个web页面同步到登录状态呢?现在是再打开新的web页面都是有登录状态的,就是第一个已经初始化的页面同步不了登录状态,求助 @xiubojin

@xiubojin
Copy link
Owner

你可以试试第二个web页面登录成功之后刷新一下第一个web页面。
另外,你说的这种免登录的方案我没用过,大多数都是通过接口拿到cookie,然后把cookie写到某个域名下达到免登录的效果。

@cww1987521
Copy link
Author

cww1987521 commented Feb 28, 2019 via email

@xiubojin
Copy link
Owner

这样写的确不行。
iOS11以上可以获取WebView的cookie存储域,往域里写cookie:
WKHTTPCookieStore *cookieStore = self.webView.configuration.websiteDataStore.httpCookieStore;
[cookieStore setCookie:cookie completionHandler:nil];

@xiubojin xiubojin closed this as completed Mar 4, 2019
@SmallWeed
Copy link

iOS 11 以下如何在打开的网页 带入cookie呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants