简体   繁体   中英

Share hyperlink on twitter using socialize framework in iOS

I am using Socialize framework for sharing on facebook and twitter. I am totally unaware as how to share hyperlinks on twitter using this framework. I checked out its documentation for twitter sharing thoroughly but no luck. Please shed some light on sharing hyperlink on twitter incase you have any clue.

Thanks

Yes you can do following to share.

#import "Social/SLComposeViewController.h"
#import "Social/SLRequest.h"
SLComposeViewController *socialVc=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
                    NSData *data = UIImageJPEGRepresentation(self.defaultImageView.image, 1.0);
                    [socialVc addImage:[UIImage imageWithData:data]];
                    [socialVc setInitialText:[NSString stringWithFormat:@"%@",@"hello"]];
                    [socialVc addURL:[NSURL URLWithString:@"www.xyz.com"]];
                    [self.navigationController presentViewController:socialVc animated:YES completion:nil];

Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM