IOS – [SNS] Sharing Image

- (void)shareDataWithText:(NSString *)text url:(NSURL *)url {
    
    DCKakaoActivity *kakaoActivity = [[DCKakaoActivity alloc] init];
    DCLineActivity *lineActivity = [[DCLineActivity alloc] init];
    
    NSArray *activityItems = @[text, url];
    NSArray *applicationActivitys = @[kakaoActivity, lineActivity];
    
    UIActivityViewController *activityViewController =
    [[UIActivityViewController alloc] initWithActivityItems:activityItems
                                      applicationActivities:applicationActivitys];
    
    //Excluded Activities Code
    activityViewController.excludedActivityTypes = @[
                                                     UIActivityTypeAddToReadingList,
                                                     UIActivityTypeAssignToContact,
                                                     //UIActivityTypeMessage,
                                                     //UIActivityTypeSaveToCameraRoll,
                                                     //UIActivityTypePrint,
                                                     //UIActivityTypePostToWeibo,
                                                     //UIActivityTypeCopyToPasteboard
                                                     ];
    
    //activate the share view
    [self presentViewController:activityViewController
                       animated:YES
                     completion:nil];
}

– (IBAction)buttonClicked:(id)sender {

    NSString *text = @”SNS Sharing”;

    NSURL *myWebsite = [NSURL URLWithString:@”http://www.rsptotime.com/”];

    [self shareDataWithText:text url:myWebsite];

}

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다