2012-08-07 4 views

답변

7

죄송합니다, 방금 찾았습니다. 여기 있습니다 :

프로젝트에 Social.framework를 추가해야합니다. 파일 다음 # import를 "사회/Social.h"

에 추가 서비스의 3 종류 만들 수 있습니다 페이스 북에 대한

SLServiceTypeTwitter 
SLServiceTypeFacebook 
SLServiceTypeSinaWeibo 

예.

SLComposeViewController *fbController = 
    [SLComposeViewController 
       composeViewControllerForServiceType:SLServiceTypeFacebook]; 


if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) 
{ 
    SLComposeViewControllerCompletionHandler __block completionHandler= 
    ^(SLComposeViewControllerResult result){ 

     [fbController dismissViewControllerAnimated:YES completion:nil]; 

     switch(result){ 
     case SLComposeViewControllerResultCancelled: 
     default: 
     { 
      NSLog(@"Cancelled....."); 

     } 
      break; 
     case SLComposeViewControllerResultDone: 
     { 
      NSLog(@"Posted...."); 
      UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Sent" 
       message:nil 
       delegate:nil 
       cancelButtonTitle:@"Dismiss" 
       otherButtonTitles: nil]; 
      [alert show]; 
     } 
      break; 
    }}; 

    [fbController addImage:[UIImage imageNamed:@"your_image.jpg"]]; 
    [fbController setInitialText:@"The initial text you want to send"]; 
    [fbController addURL:[NSURL URLWithString:@"the url you wanna share"]]; 
    [fbController setCompletionHandler:completionHandler]; 
    [self presentViewController:fbController animated:YES completion:nil]; 
} 

이 정보가 유용하게 활용되기를 바랍니다. 다른 소셜 네트워크를 원한다면 다른 두 개의 SLServiceTypeFacebook을 변경하십시오.

2

iOS 6 소셜 공유 here on github을 구현하기위한 드롭 인 테이블보기 셀을 찾을 수 있습니다. 면책 조항 - 나는 저자입니다.

2

나는 또한 나의 마지막 프로젝트에서 이런 종류의 문제에 직면했고 나는 같은 것을 Sample code for SLComposeViewController 발견했다. 나는 그것이 당신을 도울 것이라고 생각합니다.

감사합니다.

관련 문제