2015-12-16 125 views
1

我簡單的想從我的iOS應用程序做「與LinkedIn共享」。」如何爲LinkedIn生成訪問令牌?

如何分享關於聯在之前生成訪問托克,如何 產生的呢?

這裏是我的在聯在發佈代碼,但它不工作,因爲我沒有訪問令牌。

// For positing on linked In 

    [[LISDKAPIHelper sharedInstance] apiRequest:@"https://api.linkedin.com/v1/people/~/shares?format=json" method:@"POST" body:[bodyTxtView.text dataUsingEncoding:NSUTF8StringEncoding] 
       success:^(LISDKAPIResponse *response) 
       { 
        NSLog(@"success called %@", response.data); 
       } 
       error:^(LISDKAPIError *apiError) { 
        NSLog(@"error called %@", apiError.description); 

        dispatch_sync(dispatch_get_main_queue(), ^{ 
         LISDKAPIResponse *response = [apiError errorResponse]; 
                NSString *errorText; 
           if (response) 
           { 
            errorText = response.data; 
           } 
           else 
           { 
            errorText = apiError.description; 
           } 
         NSLog(@"error called %@", errorText); 
       }); 
      }]; 
+1

訪問http://stackoverflow.com/questions/21676731/generating-linkedin-access-token下載SDK(示例應用程序內)給出 –

回答

-1

你可以使用這個類可以幫助你! apikey = @「75pxdmwh5ghbi L「; secretkey = @「j3iYOXotT37VhPbM」;

consumer = [[OAConsumer alloc] initWithKey:apikey 
            secret:secretkey 
            realm:@"http://api.linkedin.com/"]; 

requestTokenURLString = @"https://api.linkedin.com/uas/oauth/requestToken"; 
accessTokenURLString = @"https://api.linkedin.com/uas/oauth/accessToken"; 
userLoginURLString = @"https://www.linkedin.com/uas/oauth/authorize";  
linkedInCallbackURL = @"hdlinked://linkedin/oauth"; 

requestTokenURL = [[NSURL URLWithString:requestTokenURLString] retain]; 
accessTokenURL = [[NSURL URLWithString:accessTokenURLString] retain]; 
userLoginURL = [[NSURL URLWithString:userLoginURLString] retain];