2012-05-07 4 views
3

나는이 링크를 따라 가고 있습니다 : https://github.com/yahoo/yos-social-objc yahoo 연락처를 검색하고 있습니다.아이폰의 yahoo 연락처를 가져 오는 중

모든 자격 증명 (예 : 비밀 키, 고객 키, 앱 ID)을 제공 한 후 로그인을 위해 브라우저로 이동합니다. 로그인 한 후 다음 메시지가 표시됩니다.

yahoo 공유를 완료하려면! info with xxxx, xxxx에 코드 xxxx를 입력하십시오.

그래서이 코드를 어디에 입력해야하는지 알지 못합니까? 어떻게 응용 프로그램으로 리디렉션됩니까?

도움이 될 것입니다.

+0

알아낼 수 있습니까? – Kamilski81

답변

0

CloudSponge에는 연락처 가져 오기 도구가있는 iOS 위젯이 있습니다. iOS 기기에서 our test drive page을 방문하여 작동 방법을 확인하십시오.

CloudSponge에서 일하고 있습니다. 궁금한 점이 있으면 알려주십시오.

+0

고마워요 @ 제이, 당신의 앱이 작동하는 것을 보았습니다 만, 그 여분의 창은 어떻게하고 있습니까? 그곳에서 무슨 일이 일어나고 있습니까? – Kamilski81

0

콜백 URL을 지정해야합니다. 기본적으로 "oob"이며 인증 코드를 제공합니다. 자신의 웹보기를 제공하고 webview 대리인을 통해 확인 코드를 모니터링하는 것이 좋습니다. 방법은 다음과 같습니다.

YOSSession *yahooSession; //instance variable 

- (IBAction)yahooButtonAction:(UIButton *)sender { 

    yahooSession = [YOSSession sessionWithConsumerKey:YAHOO_CONSUMER_KEY 
              andConsumerSecret:YAHOO_CONSUMER_SECRET 
              andApplicationId:YAHOO_APP_ID]; 

    // try to resume a user session if one exists 
    BOOL hasSession = [yahooSession resumeSession]; 

    if(hasSession == FALSE) { 
     [self fetchSession]; 
    }else{ 
     [self sendRequests]; 
    } 
} 

-(void)fetchSession{ 

    // create a new YOSAuthRequest used to fetch OAuth tokens. 
    YOSAuthRequest *tokenAuthRequest = [YOSAuthRequest requestWithSession:yahooSession]; 

    // fetch a new request token from oauth. 
    YOSRequestToken *newRequestToken = [tokenAuthRequest fetchRequestTokenWithCallbackUrl:@"http://localhost"]; 

    // if it looks like we have a valid request token 
    if(newRequestToken && newRequestToken.key && newRequestToken.secret) { 
     // store the request token for later use 
     [yahooSession setRequestToken:newRequestToken]; 
     [yahooSession saveSession]; 

     // create an authorization URL for the request token 
     NSURL *authorizationUrl = [tokenAuthRequest authUrlForRequestToken:yahooSession.requestToken]; 
     [self presentWebViewForYahooWithAuthURL:authorizationUrl]; 
     //present it in webview 

    } else { 
     // NSLog(@"error fetching request token. check your consumer key and secret."); 
    } 
} 

-(void) presentWebViewForYahooWithAuthURL:(NSURL *)url{ 

    _yahooWebView = [[UIWebView alloc] initWithFrame:self.view.frame]; 
    _yahooWebView.delegate=self; //so that we can observe the url for verifier 
    [_yahooWebView loadRequest:[NSURLRequest requestWithURL:url]]; 
    [self.view addSubview:_yahooWebView]; 
} 

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ 

    NSString *requestString = request.URL.absoluteString; 
    if ([requestString rangeOfString:@"http://localhost"].length>0) { 
     NSRange verifierRange = [requestString rangeOfString:@"oauth_verifier="]; 
     if (verifierRange.length>0) { 

      verifierRange.location =verifierRange.location+verifierRange.length; 
      verifierRange.length = requestString.length-verifierRange.location; 
      NSLog(@"Verifier => %@", [requestString substringWithRange:verifierRange]); 
      yahooSession.verifier=[requestString substringWithRange:verifierRange]; 
      [self sendRequests]; 
     } 
     return NO; 
    } 
    else{ 
     return YES; 
    } 
} 
+1

안녕하세요 @AdityaSinha, 야후와 함께 성공적으로 일해 보셨습니까? yahoo 사용자 연락처를 가져오고 싶습니다. 처음으로 응용 프로그램이 충돌합니다. 다음에 시도 할 때. 앱이 작동하고 yahoo 연락처도 가져 왔습니다. 그러나 나는 yahoo sdk에 어떤 문제가 있는지 알고 싶습니다. 가능한 경우 전체 코드를 제공하십시오. –

+1

나는 또한'ApplicationId' 매개 변수를 혼동합니다. YOSSession을 활성화 할 때 응용 프로그램 ID의 값은 무엇입니까? –

+0

또한 콜백에 대한 지식을 제공하십시오. 콜백 URL이 앱 리디렉션에 사용된다는 것을 알고 있습니다. 그리고 그것은 우리가 .plist로 쓸 것입니다. myApp와 같은 : // 그러나 우리는 YDN에 새로운 앱을 만들 때 콜백 URL (페이스 북과 같은)을 요청하고 이것은 http 나 https로 시작하지 않는 어떤 종류의 문자열도 받아들이지 않습니다. –

관련 문제