Hi, I am having a cocoa mac application in objective c.
In my app, I want to share text on facebook and twitter like we do in ios with SLComposeViewController.
I searched a lot on google but couldn't find anything for mac application.
I see the above image when I share it from facebook and same for the twitter from one of the mac apps.
How can I achieve the same for my mac application?
Thanks in advance...
I searched it with @TheAmateurProgrammer's help about NSSharingService
and NSSharingServicePicker
.
I found the solution from the link.
NSArray* array = @[ @"myText"];
NSSharingService* sharingServiceFB = [NSSharingService sharingServiceNamed:NSSharingServiceNamePostOnFacebook];
[sharingServiceFB performWithItems:array];
NSArray* array = @[ @"myText"];
NSSharingService* sharingServiceFB = [NSSharingService sharingServiceNamed:NSSharingServiceNamePostOnTwitter];
[sharingServiceFB performWithItems:array];
Hope it helps someone else also...
Thanks...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With