Foursquare 登录页面现在返回来自 Facebook 网站的请求。因此,您可以使用 FB 凭据登录 Foursquare。
其中一个响应破坏了Foursquare2逻辑
https://s-static.ak.facebook.com/connect/xd_arbiter.php?version=10#cb=xxx&origin=https%3A%2F%2Ffoursquare.com%2Fxxx&domain=foursquare。 com&relation=parent&frame=xxx&错误=unknown_user
Foursquare2 在响应中寻找“error=”。如果找到它,它会执行委托回调。
要修复它,请替换您的 ' webView:shouldStartLoadWithRequest:navigationType:'
在 Foursquare2.m 中
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSString *url =[[request URL] absoluteString];
if ([url rangeOfString:@"facebook.com"].location != NSNotFound)
return YES; //ignore Facebook authentication
if ([url rangeOfString:@"code="].length != 0) {
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
if ([[cookie domain]isEqualToString:@"foursquare.com"]) {
[storage deleteCookie:cookie];
}
}
NSArray *arr = [url componentsSeparatedByString:@"="];
[delegate performSelector:selector withObject:[arr objectAtIndex:1]];
[self cancel];
}else if ([url rangeOfString:@"error="].length != 0) {
NSArray *arr = [url componentsSeparatedByString:@"="];
[delegate performSelector:selector withObject:[arr objectAtIndex:1]];
FourSquareLog(@"Foursquare: %@",[arr objectAtIndex:1]);
}
return YES;
}
注意一个新的
if ([url rangeOfString:@"facebook.com"].location != NSNotFound)
return YES; //ignore Facebook authentication