Robert Marlan
Robert Marlan

Reputation: 369

IOS Safari URL UTI share sheet

I am trying to pass the current URL from safari to my app using the safari share button and share sheet. I want this to go to my app and not have it be a share extension. From safari, the share sheet does not show my app. I have registered the following document types (UTI) without success:

public.url  
public.file-url 
public.url-name  

My app does show up from a pdf document share using com.adobe.pdf without any issues. Any help sharing the URL from safari would be most appreciated. I am also having a similar issue with using share button from a photo displayed from the apple app.

What are the correct UTI for safari url and a photo via the share button to properly appear on the share sheet? Thanks.

Bob

Upvotes: 4

Views: 1525

Answers (2)

BT b killin me
BT b killin me

Reputation: 81

I just dealt w/ this issue. It appears to be a Safari issue and not an App configuration issue. So long as your permissions are set correctly per the documentation, try testing in google chrome. Shares just fine from there...

Upvotes: 0

Bocaxica
Bocaxica

Reputation: 4680

  • Go to the project (root element in the Project Navigator) and select your Share target
  • Go to Info
  • Open NSEXtension -> NSExtensionAttributes -> NSExtensionActivationRule
  • For URL Support: Add NSExtensionActivationSupportsWebURLWithMaxCount underneath NSExtensionActivationRule (type is Number, the value is any number higher than 0 depending how many URL's you allow to handle in one share action)
  • For Photo and/or Video Support add NSExtensionActivationSupportsImageWithMaxCount and/or NSExtensionActivationSupportsMovieWithMaxCount
  • For other file types add NSExtensionActivationSupportsFileWithMaxCount

In the raw code of the Info.plist file of your Share target it will look like this:

<key>NSExtension</key>
<dict>
    <key>NSExtensionAttributes</key>
    <dict>
        <key>NSExtensionActivationRule</key>
        <dict>
            <key>NSExtensionActivationSupportsFileWithMaxCount</key>
            <integer>10</integer>
            <key>NSExtensionActivationSupportsImageWithMaxCount</key>
            <integer>10</integer>
            <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
            <integer>10</integer>
            <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
            <integer>1</integer>
        </dict>
    </dict>
    <key>NSExtensionMainStoryboard</key>
    <string>YourStoryboard</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.share-services</string>
</dict>

NOTE for people who don't see their app appearing in Dropbox'es Export sheet: Dropbox passes a URL to the share sheet, you'd have to support NSExtensionActivationSupportsWebURLWithMaxCount

Upvotes: 1

Related Questions