Iphone Foursqaure2API V2登录错误

Iphone Foursqaure2API V2登录错误,iphone,foursquare,Iphone,Foursquare,我正在尝试使用foursquare api登录foursquare。它显示登录页面,但当我试图输入用户名或密码时崩溃。前几天它工作正常,但突然停止工作 Server responded with:400, bad request 2012-08-24 14:44:25.227[1962:17903] contant data {"error":"invalid_grant"} 2012-08-24 14:44:25.228[1962:17903] *** Terminating app due

我正在尝试使用foursquare api登录foursquare。它显示登录页面,但当我试图输入用户名或密码时崩溃。前几天它工作正常,但突然停止工作

Server responded with:400, bad request
2012-08-24 14:44:25.227[1962:17903] contant data {"error":"invalid_grant"}
2012-08-24 14:44:25.228[1962:17903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: foursquare_access_token)'

请帮帮我。为什么会出现此错误?

获取自己的密钥使用者密钥和密码,以便在上应用程序

在中具有应用程序更新或替换的使用者密钥和密码后

 Constants.h file of your poject

Foursquare登录页面现在返回来自Facebook网站的请求。 因此,您可以使用FB凭据登录Foursquare

其中一个响应阻止了Foursquare2逻辑 错误=未知用户

Foursquare2正在响应中查找“error=”。如果找到它,它将执行委托回调

要修复它,请替换您的 'webView:shouldStartLoadWithRequest:navigationType:'

在Foursquare 2.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

谢谢你的回答,非常有帮助。我想知道,怎样才能让facebook按钮正常工作?用你的解决方案,一旦我按下按钮,屏幕将变为空白,没有任何内容加载。但如果我不想忽略Facebook身份验证,该怎么办?我想从Facebook登录foursquare?