achorein / expo-share-intent

🚀 Simple share intent in an Expo Native Module
MIT License
174 stars 15 forks source link

Apple Maps not able to find Share Extension #60

Closed cback97 closed 4 months ago

cback97 commented 4 months ago

Describe the bug I am trying to share from apple maps to my main application through the share extension, I even went into the ShareExtension-Info.plist and added an NSExtensionActivationRule, that should allow the data type, however the extension is still not showing up and I cannot figure out why.

 <key>NSExtension</key>
    <dict>
      <key>NSExtensionAttributes</key>
      <dict>
        <key>NSExtensionActivationRule</key>
        <dict>
          <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsImageWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
          <integer>1</integer>
          <key>NSExtensionActivationRule</key>
          <string>SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url").@count >= 1).@count == 1</string>
        </dict>
achorein commented 4 months ago

Sharing for apple maps it's not supported, i mean i didn't test it but i think it should need some ajustement in shareextension to handle this data type.

However the extension should be showing with the good activation rule, can you try to add it in the plugin configuration :

"expo-share-intent",
{
    "iosActivationRules": {
        "NSExtensionActivationRule": "SUBQUERY(extensionItems,$extensionItem,SUBQUERY($extensionItem.attachments,$attachment,SUBQUERY($attachment.registeredTypeIdentifiers, $uti, $uti UTI-CONFORMS-TO \"public.url\" AND NOT $uti UTI-CONFORMS-TO \"public.file-url\").@count &gt;= 1).@count &gt;= 1).@count &gt;= 1"
    },
}
cback97 commented 4 months ago

totally resolved, I changed the attributes to the following and it worked well! Thank you :)

   <key>NSExtension</key>
    <dict>
      <key>NSExtensionAttributes</key>
      <dict>
        <key>NSExtensionActivationRule</key>
        <string>SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url").@count >= 1).@count == 1</string>
      </dict>
      <key>NSExtensionMainStoryboard</key>
      <string>MainInterface</string>
      <key>NSExtensionPointIdentifier</key>
      <string>com.apple.share-services</string>
    </dict>
cback97 commented 4 months ago

Thank you for being a super start btw! @achorein

justindavies commented 4 months ago

Just a heads up if you are going to place the rule within the app.json, it needs to be this:

"expo-share-intent", { "iosActivationRules": "SUBQUERY(extensionItems,$extensionItem,SUBQUERY($extensionItem.attachments,$attachment,SUBQUERY($attachment.registeredTypeIdentifiers, $uti, $uti UTI-CONFORMS-TO \"public.vcard\" ).@count >= 1).@count >= 1).@count >= 1"

}

Otherwise you get a nested NSExtensionActivationRule

Why Apple can't just have a pre-set for VCARD I have no idea - but hope this helps people coming to this