2013-05-29 7 views
5

Possiamo condividere un messaggio (testo) tramite l'integrazione di LinkedIn nelle app per iPhone. Inoltre, posso condividere un image Url in LinkedIN, ma c'è la possibilità di condividere un URL video tramite LinkedIn in iPhone Apps ......?Condivisione di un URL video in integrazione con LinkedIn in iPhone

Grazie in anticipo .....

+0

come hai fatto a inviare un messaggio con l'URL come: http://www.youtube.com/watch?v=_FaWTNEyG80 alcun aiuto – vensan

risposta

2

Usa MIS-LinkedIn-Share per condividere l'url.

Basta scrivere il seguente codice per condividere.

- (IBAction)share:(id)sender { 
[[MISLinkedinShare sharedInstance] shareContent:self postTitle:@"Title" postDescription:@"Description" postURL:@"http://www.youtube.com/watch?v=_FaWTNEyG80" postImageURL:@"http://www.google.com/images/errors/logo_sm.gif"]; 
} 

non dimenticare di impostare api e chiave segreta prima della condivisione.

O

è anche possibile utilizzare il metodo con oAuthStarterkit per condividere url: - Codice

Qui sta lavorando per oAuthStarterKit

1) Aprire il file OAuthLoginView.m

2) Trova il metodo initLinkedInApi, aggiungi qui le tue API e le tue chiavi segrete.

3) Le righe di commento su viewDidAppear in OAuthLoginView come

- (void)viewDidAppear:(BOOL)animated 
{ 
    if ([apikey length] < 64 || [secretkey length] < 64) 
    { 
//  UIAlertView *alert = [[UIAlertView alloc] 
//       initWithTitle: @"OAuth Starter Kit" 
//       message: @"You must add your apikey and secretkey. See the project file readme.txt" 
//       delegate: nil 
//       cancelButtonTitle:@"OK" 
//       otherButtonTitles:nil]; 
//  [alert show]; 
//  [alert release]; 
//   
//  // Notify parent and close this view 
//  [[NSNotificationCenter defaultCenter] 
//   postNotificationName:@"loginViewDidFinish"   
//   object:self 
//   userInfo:self.profile]; 

//  [self dismissModalViewControllerAnimated:YES]; 
    } 

    [self requestTokenFromProvider]; 
} 

- (void)shareImp 
{ 
    NSLog(@"share Imp called "); 
    NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/shares"]; 
    OAMutableURLRequest *request =[[OAMutableURLRequest alloc] initWithURL:url 
            consumer:consumer 
             token:self.accessToken 
            callback:nil 
          signatureProvider:nil]; 

    NSMutableDictionary *contents=[[NSMutableDictionary alloc] init]; 
    [contents setValue:@"description goes here" forKey:@"description"]; 
    [contents setValue:@"www.google.com" forKey:@"submitted-url"]; 
    [contents setValue:@"title goes here" forKey:@"title"]; 
    [contents setValue:@"http://economy.blog.ocregister.com/files/2009/01/linkedin-logo.jpg" forKey:@"submitted-image-url"]; 

    NSMutableDictionary *visible=[[NSMutableDictionary alloc] init]; 
    [visible setValue:@"anyone" forKey:@"code"]; 

    NSMutableDictionary *updatedic=[[NSMutableDictionary alloc] init]; 

    [updatedic setObject:visible forKey:@"visibility"]; 
    [updatedic setObject:contents forKey:@"content"]; 
    [updatedic setValue:@"Check out the LinkedIn Share API!" forKey:@"comment"]; 

    NSMutableData *data = [[NSMutableData alloc] init]; 
    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; 
    [archiver encodeObject:updatedic forKey:@"share"]; 
    [archiver finishEncoding]; 
    [archiver release]; 

    NSLog(@"post dictionary is %@",updatedic); 


    NSData *postData=[NSData dataWithData:data]; 
    [request setValue:@"json" forHTTPHeaderField:@"x-li-format"]; 
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; 
    [request setValue:[NSString stringWithFormat:@"%d",[postData length]] forHTTPHeaderField:@"Content-Length"]; 

    [request setHTTPBody:postData]; 
    [request setHTTPMethod:@"POST"]; 

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

    [request release]; 
} 

- (void)postUpdateApiCallResult:(OAServiceTicket *)ticket didFinish:(NSData *)data 
{ 
    NSLog(@"did finish called "); 

    NSString *responseBody = [[NSString alloc] initWithData:data 
                encoding:NSUTF8StringEncoding]; 

    NSLog(@"response body after posting is %@",responseBody); 

    [responseBody release]; 
    [self dismissModalViewControllerAnimated:YES]; 
} 

- (void)postUpdateApiCallResult:(OAServiceTicket *)ticket didFail:(NSData *)error 
{ 
    NSLog(@"%@",[error description]); 
} 
+0

ho provato il tuo codice in [MIS-LinkedIn-Share], dopo averlo postato con successo non viene visualizzato su LinkedIn se postUrl è [http://www.youtube.com/watch?v=_FaWTNEyG80], qualche aiuto? – vensan

+0

stesso successo a me .. dopo il post di successo non arriva agli aggiornamenti – iAnkit

0

Utilizzando cornice di lavoro Sharekit siamo in grado di inviare l'URL del video in LinkedIn.for che possiamo passare url come una stringa,

SHKItem *shareItem = [SHKItem text:text]; 
    [SHKLinkedIn shareItem:shareItem]; 
+1

Questo sharekit mi sta mangiando la testa, non si installa correttamente. – iCoder4777

Problemi correlati