macOS Sharing Services: NSExtensionActivationRule PDF predicate not working

Originator:ddiener.kiel
Number:rdar://30184633 Date Originated:26-Jan-2017
Status:Open Resolved:no
Product:macOS + SDK Product Version:10.12.2 (16C67)
Classification: Reproducible:yes
 
Area:
Something not on this list

Summary:
The user can select a single pdf document, click the share button and select my extension. However, the extension is not being displayed. It has something to do with the NSExtensionActivationRule key in the info.plst. 

SUBQUERY (
    extensionItems,
    $extensionItem,
    SUBQUERY (
        $extensionItem.attachments,
        $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
    ).@count == $extensionItem.attachments.@count
).@count == 1

is being used for the query. It has been copied from the apple docs: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html

Apple Developer Technical Support says:
"According to the engineering team, this is a bug in Sharing Services.  The item being shared by Preview and Finder is a URL to the open/selected file.  Sharing Services is supposed to acquire the UTI of the file referenced by the URL and register it in the extension item attachment's registeredTypeIdentifiers.  This is not happening for PDF files.  As a result, the only registered type identifier is "public.file-url" (the UTI of URLs) which your query does not permit."

Steps to Reproduce:
1. Download attached Xcode project.
2. Open project and build and run the extension target in Finder.app or Preview.app
3. Select one or multiple files and press the share button

Expected Results:
The share extension for the test app should only be displayed when a single PDF file use selected.

Actual Results:
The share extension is not being displayed in Finder. In Preview it is being displayed.

Version:
macOS 10.12.2 (16C67)

Notes:


Configuration:


Attachments:
https://github.com/Iomegan/PDF-Share-Extension-App

Comments

Duplicate of 30166215 (Open)

By ddiener.kiel at Jan. 28, 2017, 5:11 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!