linkedin objective-c库范围电子邮件地址

时间:2013-05-03 14:42:47

标签: objective-c linkedin

我正在尝试更新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]];

但这不起作用

1 个答案:

答案 0 :(得分: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:)];

    }