Using a macOS text processing service with Preview

I have an Objective-C macOS app which provides a service that provides unique services on selected text.

This app has been for sale in the Mac App Store for several years. The app registers as service provider during 'appDidFinishLaunching' with: [[NSApplication sharedApplication] setServicesProvider:self];

When my service is invoked it uses the standard service method:

  • (void)serviceName:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error

In the body of this standard service method the contents of the NSPasteboard (pboard) are examined and consumed by my app.

- (void) kudosService:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error; {
    if ([pboard pasteboardItems].count==0) { return; }
	NSPasteboardItem *pI = [pboard pasteboardItems][0];
	NSLog(@"pI:%@",pI.types );
	for (NSString *uti in pI.types) {
	    NSLog(@"uti:%@ string:%@",uti, [pI stringForType:uti] );
	}
...
}

Something has changed with Preview app; at this point I'm inclined to think the change occurred with version 11.

Console output for Preview

pI:( "public.utf8-plain-text", "public.rtf", "public.utf16-external-plain-text" )

uti:public.utf8-plain-text string:(null)

uti:public.rtf string:(null)

uti:public.utf16-external-plain-text string:(null)

This is the output regardless of whether or not the user has a mere text selection OR has formally 'Cop(ied)' [Cmd-C] the text in the Preview window!

Please NOTE if I open the exact same .pdf document in Safari and invoke the service from Safari I see the expected Console output:

pI:( "public.utf8-plain-text" )

uti:public.utf8-plain-text string:The Best Gluten-Free Chocolate Cake

When did this change in Preview behavior occur?

Can anyone point me to some documentation, which I have obviously overlooked, that would shed some light on this matter!

Using a macOS text processing service with Preview
 
 
Q