In my OS X app, I want to let the user edit images with the appropriate action extensions installed on his/her Mac, e.g the image markup extension as present in Mail.app or TextEdit (for RTFD files with images) - or Pixelmator's repair tool if available. As far as I can recall, Apple announces at WWDC '14 there would be a public API for this task.
Unfortunately I cannot find any starting point on how to use extensions from a host app perspective, neither documentation- nor sample-code-wise.
I found out that you have to set the undocumented style property of the NSSharingPicker to a non-zero value like this:
- (IBAction)testSharingPicker:(id)sender
{
NSSharingServicePicker *picker = [[NSSharingServicePicker alloc] initWithItems:@[[self.listing.images.firstObject thumbImage]]];
[picker setValue:@(1) forKey:@"style"];
[picker setDelegate:self];
[picker showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
}
Once the style value is set, you know you are on the right track, because - (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items proposedSharingServices:(NSArray *)proposedServices
is called with the image editing extensions installed on my system, instead of the regular sharing extensions.
You also need to implement an undocumented delegate method:
- (BOOL)sharingServicePicker:(NSSharingServicePicker *)sharingService shouldShowForView:(NSView*) inView
{
return YES;
}
But still, the picker is not showing up. All I get is some weird border around the sender
button.