0

我正在尝试更新 Linkedin Objective-c 库 https://github.com/synedra/LinkedIn-OAuth-Sample-Client

以允许检索电子邮件地址。

我怎样才能做到这一点?

我试着改变

OARequestParameter *nameParam = [[OARequestParameter alloc] initWithName:@"scope"
                                                                   value:@"r_fullprofile r_contactinfo r_emailaddress"];
NSArray *params = [NSArray arrayWithObjects:nameParam, nil];
[request setParameters:params];
OARequestParameter * scopeParameter=[OARequestParameter requestParameter:@"scope" value:@"r_fullprofile r_contactinfo r_emailaddress"];

[request setParameters:[NSArray arrayWithObject:scopeParameter]];

但这不起作用

4

1 回答 1

0

您不需要做所有这些事情,只需在您的应用设置中选择所需的范围即可。保持代码如下所示的简单。登录视图中的链接将自动显示您选择的所有范围。

- (void)requestTokenFromProvider
    {

         OAMutableURLRequest *request = 
                [[[OAMutableURLRequest alloc] initWithURL:requestTokenURL
                                                 consumer:self.consumer
                                                    token:nil   
                                                 callback:linkedInCallbackURL
                                        signatureProvider:nil] autorelease];

        [request setHTTPMethod:@"POST"];  

        OADataFetcher *fetcher = [[[OADataFetcher alloc] init] autorelease];
        [fetcher fetchDataWithRequest:request
                             delegate:self
                    didFinishSelector:@selector(requestTokenResult:didFinish:)
                      didFailSelector:@selector(requestTokenResult:didFail:)];

    }
于 2013-09-18T10:01:05.330 回答