-
Notifications
You must be signed in to change notification settings - Fork 115
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
Comments
你可以试试第二个web页面登录成功之后刷新一下第一个web页面。 |
我是这样写入cookie的
- (void)interceptRequestWithNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *host = navigationAction.request.URL.host;
if (host.length > 0 && VALID_STRING([UserDefaults objectForKey:kCustomerid])) {
NSString *cookieStr = [UserDefaults objectForKey:@"OCSESSID"];
DLog(@"cookieStr ******** %@",cookieStr);
NSMutableURLRequest *request = (NSMutableURLRequest*)navigationAction.request;
if (cookieStr.length > 0) {
[request addValue:[NSString stringWithFormat:@"session_id=%@",cookieStr] forHTTPHeaderField:@"Cookie"];
[request addValue:@"ABC=abc" forHTTPHeaderField:@"Cookie"];
DLog(@"添加后的cookie ##### %@",[request valueForHTTPHeaderField:@"Cookie"]);
}
}
// [self.webView loadRequest:request];
decisionHandler(WKNavigationActionPolicyAllow);
}
但是php服务端说取不到我的cookie,你看我这样写有问题吗?
… 在 2019年2月27日,上午9:42,fou7 ***@***.***> 写道:
你可以试试第二个web页面登录成功之后刷新一下第一个web页面。
另外,你说的这种免登录的方案我没用过,大多数都是通过接口拿到cookie,然后把cookie写到某个域名下达到免登录的效果。
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AK4_w0Rigq0zLCkarEmHANrXmxxfmV_oks5vReJvgaJpZM4bR4yi>.
|
这样写的确不行。 |
iOS 11 以下如何在打开的网页 带入cookie呢? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
楼主,我先打开一个web页面作为tab的第一个页面,随后再通过第二个web页面登录成功,如何让第一个web页面同步到登录状态呢?现在是再打开新的web页面都是有登录状态的,就是第一个已经初始化的页面同步不了登录状态,求助 @xiubojin
The text was updated successfully, but these errors were encountered: