Pages

Saturday, December 29, 2012

NSSharingService on mountain lion without sharing window


On mountain lion, I try the new sharing possiblities with the NSSharingService class of AppKit.framework


Everything goes fine with this three lines of code



NSArray* array = @[ @"myText", [NSImage imageNamed:@"myImageFile"] ];

NSSharingService* sharingServiceFB = [NSSharingService sharingServiceNamed:NSSharingServiceNamePostOnFacebook];

[sharingServiceFB performWithItems:array];



But, when I run this code awindow appears asking me if I want to "Publish" or "Cancel"



I'd like to do the same sharing without this window generated by the performWithItems function.


As I'm considering that the user of my application don't want to confirm.


I've looked in the NSSharingService reference and I don't see any functions that can help me.


I figure that I need send a "Publish" command to this window. I'm new to objective c and I don't really know how to figure it out (or even if it's the best solution).


Any help would be appreciated.


View the original article here

0 comments:

Post a Comment