【问题标题】:Yahoo API Integration?雅虎 API 集成?
【发布时间】:2011-09-09 11:57:49
【问题描述】:

我必须在我的应用程序中集成 yahoo api。谁能提供我的步骤?

由于我们已经集成了雅虎,我们从雅虎获得了一个令牌密钥,输入密钥后我们进入应用程序。有没有人在雅虎登录后直接进入应用程序。

【问题讨论】:

    标签: iphone yahoo-api


    【解决方案1】:

    试试这个初学者链接:

    http://developer.yahoo.com/social/sdk/objectivec/

    【讨论】:

      【解决方案2】:

      这是使用 Yahoo! 的 XML 部分的代码子集答案。我写这个是为了写我自己的答案应用程序。

          NSString *question =  @"Who won the 1975 World Series?";
          NSString *address = @"http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=iQuestion&query=";
          NSString *request = [NSString stringWithFormat:@"%@%@",address,question];
          NSURL *URL = [NSURL URLWithString:request];
          NSError *error;    
          NSString *XML = [NSString stringWithContentsOfURL:URL encoding:NSASCIIStringEncoding error:&error];
      
          // Extract current answer the 'dirty' way
          NSString *answer = [[[[XML componentsSeparatedByString:@"<ChosenAnswer>"] 
          objectAtIndex:1] componentsSeparatedByString:@"</ChosenAnswer>"] objectAtIndex:0];
          NSLog(@"%@", answer);
      

      XML 提取非常粗糙,如果您愿意,最好的替代方法是使用 XMLParser 或 XMLDocument,而不是进行字符串外插。这有点像贫民窟

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-06-22
        • 2011-11-21
        • 2012-09-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-27
        • 1970-01-01
        相关资源
        最近更新 更多