2017-10-19 83 views
1

我有以下規則設置iOS的11 PDF份額擴展

<dict> 
      <key>NSExtensionActivationRule</key> 
      <string> 
       SUBQUERY (
       extensionItems, 
       $extensionItem, 
       SUBQUERY (
       $extensionItem.attachments, 
       $attachment, 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf" OR 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" OR 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" OR 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" OR 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "pdf" OR 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.pdf" OR 
       ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" 
       )[email protected] == [email protected] 
       )[email protected] == 1 
      </string> 
      <key>NSExtensionJavaScriptPreprocessingFile</key> 
      <string>JavascriptPreprocessor</string> 
     </dict> 

,當我轉到Safari爲PDF,在iOS的10我看到在iOS上11我的份額擴展我看不出來。有沒有額外的uti-conforms - 我需要添加到它能夠在任何人都知道的iOS 11上工作?

回答

0

我有完全相同的問題,我注意到一些UTI(例如public.url)禁用了PDF UTI。如果刪除它們,則從網頁加載PDF時會顯示擴展名。換句話說,它似乎包括一個禁用另一個。我的解決方案是手動查找適用於BOTH pdf和網頁的UTI。如果pdf來自網頁,這個配置應該適用於iOS 11.0和以前的版本(至少它可以在xcode9的模擬器中運行)。

SUBQUERY (
      extensionItems, 
      $extensionItem, 
      SUBQUERY (
      $extensionItem.attachments, 
      $attachment, 
      (
      ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" 
      || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text"; 
      ) 
      )[email protected] == [email protected] 
      )[email protected] == 1 

更新:我已經添加

|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" 

允許擴展至Chrome和Firefox在HTML和PDF文件中可以看出。