2012-08-24 3 views
1

foursquare api를 사용하여 foursquare에 로그인하려고합니다. 로그인 페이지를 보이고 있지만 사용자 이름이나 비밀번호를 입력하려고 할 때 충돌합니다. 며칠 전에 잘 작동했지만 갑자기 일하는 것을 멈 춥니 다.Foursqaure2 API V2 로그인 오류

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)' 

도와주세요. 왜이 오류가 발생합니까?

답변

0

지금 페이스 북 웹 사이트에서 요청을 반환 응용 프로그램 업데이트에 대한 소비자의 키와 비밀을 가진 후 행해져 Yout이

oauth에 응용 프로그램에 대한 중요한 소비자 키와 비밀을 소유 받거나

Constants.h file of your poject 
3

포 스퀘어 로그인 페이지로 대체합니다. 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이 찾고있는 그 응답 브레이크 "오류 ="의

하나. 발견 된 경우 대리인 콜백을 수행합니다.

은 당신의 대체 해결하려면 '웹보기를 : 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 
+0

은 그것이 귀하의 답변에 감사드립니다 매우 도움이됩니다. 나는 페이스 북 버튼으로 로그인을 제대로하려면 어떻게해야할까요? 버튼을 누르면 솔루션이 화면에 나타나고 아무 것도로드되지 않습니다. – NullSleep

+0

하지만 Facebook 인증을 무시하고 싶지 않으면 어떻게해야합니까? 나는 Facebook에서 foursquare로 로그인하고 싶습니다. –