2016-06-28 13 views
0

私は初心者で、私のアプリケーションにlinkedinを統合する必要があります。クライアントIDとクライアント秘密を生成しました。私はlinkedinのドキュメントを読んだことがありますが、私はいくつかのエラーが発生するたびに同じように私を導いてください。私はこれを試してみましたが、私もAppDelegateクラスでは、この5月には、あなたが作成しissue on iosでLinkedinを統合する

+1

-(void) linkedinTap{ NSArray *permissions = [NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, nil]; [LISDKSessionManager createSessionWithAuth:permissions state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnState) { NSLog(@"%s","success called!"); LISDKSession *session = [[LISDKSessionManager sharedInstance] session]; NSLog(@"Session : %@", session.description); } errorBlock:^(NSError *error) { NSLog(@"%s","error called!"); }]; } -(void) getRequest:(NSString*)token{ [[LISDKAPIHelper sharedInstance] getRequest:@"https://api.linkedin.com/v1/people/~" success:^(LISDKAPIResponse *response) { NSData* data = [response.data dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *dictResponse = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; NSLog(@"Authenticated user name : %@ %@", [dictResponse valueForKey: @"firstName"], [dictResponse valueForKey: @"lastName"]); } error:^(LISDKAPIError *apiError) { NSLog(@"Error : %@", apiError); }]; } 

:あなたのViewControllerでこれを行いますか? – Signare

+0

実際に私は彼らが段階的に説明したgoogleのfacebookを統合しましたが、linkinにそのような説明はありません –

+0

検索すると、githubからデモプロジェクトを取得します。これを実装してテストすることができます。 – Signare

答えて

0

役立ちます

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 
    if ([LISDKCallbackHandler shouldHandleUrl:url]) { 
     return [LISDKCallbackHandler application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; 
    } 
    return YES; 
} 
0
  [LISDKSessionManager createSessionWithAuth:[NSArray arrayWithObjects:LISDK_W_SHARE_PERMISSION, nil] 
                  state:@"some state" 
              showGoToAppStoreDialog:YES 
                 successBlock:^(NSString *returnState) { 

                  NSLog(@"%s","success called!"); 
                  NSLog(@"Access Token: %@", [[[LISDKSessionManager sharedInstance] session].accessToken description]); 

     NSString *url = @"https://api.linkedin.com/v1/people/~/shares"; 
     NSString *str = @"Your String"; 
     NSString *payload = @"Your Payload"; 
    if ([LISDKSessionManager hasValidSession]) { 
                   [[LISDKAPIHelper sharedInstance] postRequest:url stringBody:payload 
                            success:^(LISDKAPIResponse *response) { 
                             // do something with response 
                             NSLog(@"%s","success called!"); 
                             UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Linkedin" message:@"Shared successfully." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil]; 
    [alert show]; 
                            } 
                            error:^(LISDKAPIError *apiError) { 
                             // do something with error 
                             NSLog(@"%s","error called!");                        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Oops!" message:@"There was a problem sharing. Please try again later." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil]; 
                             [alert show]; 
                            }]; 
                  } 
                 } 
                 errorBlock:^(NSError *error) { 
NSLog(@"%s %@","error called! ", [error description]); 
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Oops!" message:@"There was a problem sharing. Please try again later." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil]; 
[alert show]; 
} 
]; 

希望を書かれたものを

[[LISDKAPIHelper sharedInstance]getRequest:(NSString *)url success:^(LISDKAPIResponse *) { 

    } error:^(LISDKAPIError *) 
    { 

    }]; 

の内側に書くために知っていないget要求のために あなたのViewControllerのUIButtonのコンセント

Info.plistのはLSApplicationQueriesSchemes

  1. LinkedInの-SDK
  2. LinkedInの-sdk2

の下に以下を追加します。また、あなたのplistファイルであなたのLinkedInのアプリIDを追加します。あなたが取得しているかのエラー、あなたのAppDelegate

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 
    return [LISDKCallbackHandler application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; 
    return YES; 
} 
+0

[APP_DELEGATE removeLoader]これは動作しません –

+0

申し訳ありません。その行を削除してください...そのコード... はこのコードが@NarendraPandeyで動作していますか? –

関連する問題