2014-03-03 1 views
0

Facebook에 대한 링크를 공유해야합니다. 사용자가 링크를 누르면 다른 페이지로 연결됩니다. https://developers.facebook.com/docs/ios/share/iOS Facebook의 하이퍼 링크

을 당신은 "링크"키를 사용해야합니다 :

나는

-(void)fbShare 
{ 
    [hud show:YES]; 
    NSString *title=[NSString stringWithFormat:@"www.google.com"]; 
    MAAppDelegate *appdelegate = (MAAppDelegate *)[[UIApplication sharedApplication] delegate] ; 
    if (!appdelegate.session) { 
     appdelegate.session = [[FBSession alloc]initWithPermissions:[NSArray arrayWithObjects:@"publish_stream",nil]]; 
    } 
    if (![appdelegate.session isOpen]) { 
     [appdelegate.session openWithCompletionHandler:^(FBSession *session, FBSessionState status, NSError *error) { 
      if (!error) { 
       [self Share:title]; 
      }else { 
       NSLog(@"facebook errror %@",error.description); 
       [hud hide:YES]; 
      } 
     }]; 
    } else { 
     [self Share:title]; 
    } 
} 

-(void)Share:(NSString *)text 
{ 
    MAAppDelegate *appdelegate = (MAAppDelegate *)[[UIApplication sharedApplication] delegate]; 
    UIImage *image = [UIImage imageNamed:@"bath3.png"]; 
    [FBSession setActiveSession:appdelegate.session]; 
    NSData *dataImage=UIImageJPEGRepresentation(image,1.0); 
    NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:text, @"name", dataImage, @"picture", @"image/png", @"content_type", nil]; 
    FBRequest *request=[FBRequest requestWithGraphPath:@"me/photos" parameters:parameters HTTPMethod:@"POST"]; 
    [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
     if(!error) { 
      NSLog(@"Success"); 
      [hud hide:YES]; 
      UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Audalize POC" message:@"Shared Successfully" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; 
      [alert show]; 
     } else { 
      [hud hide:YES]; 
      NSLog(@"failed %@",error.localizedDescription); 
     } 
    }]; 
} 

답변

1

이 .. 읽기 단지 string..it이 하이퍼 링크처럼 행동하지 도다 공유하는 것이 code..but 다음 시도 페이스 북에 링크를 공유하기.

예 :

[NSMutableDictionary dictionaryWithObjectsAndKeys:text,@"link", // < ---- 
        dataImage,@"picture", 
        @"image/png",@"content_type" 
        ,nil]; 
+0

[NSMutableDictionary의 dictionaryWithObjectsAndKeys : @ "https://www.google.co.in/", "링크"@ "이름"@ "안녕하세요 사람", @, dataImage , @ "picture", @ "image/png", @ "content_type" , nil]; –

+0

이 링크를 사용하지 않고 링크를 표시하지 않습니다 ... –

+0

내 링크는 http : //와 "https://www.google.co.in/"입니다. –