-(void)webViewDidStartLoad:(UIWebView *)webView{
NSURL * hostUrl = [NSURL URLWithString:@"http://map.baidu.com"];
NSArray *headeringCookie = [NSHTTPCookie cookiesWithResponseHeaderFields:@{@"Set-Cookie":@"Chdover=1"} forURL:hostUrl];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:headeringCookie
forURL:hostUrl
mainDocumentURL:nil];
NSURL * hostUrl = [NSURL URLWithString:@"http://map.baidu.com"];
NSArray *headeringCookie = [NSHTTPCookie cookiesWithResponseHeaderFields:@{@"Set-Cookie":@"Chdover=1"} forURL:hostUrl];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:headeringCookie
forURL:hostUrl
mainDocumentURL:nil];
本文介绍如何使用 Objective-C 在 UIWebView 加载百度地图,并通过设置 HTTP Cookie 来预设地图的一些参数。
3196

被折叠的 条评论
为什么被折叠?



