Call NSSharingService from sharingExtension

I am trying to send a mail from within a sharingextension with the NSSharingService.


There is no error in Console or in any other media i can debug.

Did anyone manage to use the

NSSharingService* sharingService = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail];


My code brings up the Mail dialog as soon as I copy it to a fresh cocoa app and run it. Only in my sharingExtension it is not working.


from within an sharingExtension, or is it just not allowed / supported.


Thanks

Daniel

Replies

I use this in an NSDocumentController subclass and it works fine.


//------------------------------------------------------------------------------------------------

-(IBAction)shareCurrentDocumentAction:(id)sender {

NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"\n\n"];

NSURL *theURL = [[self currentDocument] fileURL];

NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail];

[service performWithItems:[NSArray arrayWithObjects:text, theURL, nil]];

}

//-------------------------------------------------------------------------------------------------------

Hi. I'm doing something similar. Were you able to solve this issue?