0

I want to share files to my Swift app via UIActivityViewController. I tried:

UIFileSharingEnabled 
and 
<key>NSExtension</key>
<dict>
    <key>NSExtensionAttributes</key>
    <dict>
        <key>NSExtensionActivationRule</key>
        <dict>
            <key>NSExtensionActivationSupportsImageWithMaxCount</key>
            <integer>1</integer>
        </dict>
    </dict>
    <key>NSExtensionMainStoryboard</key>
    <string>MainInterface</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.ui-services</string>
</dict>

when user tap to share any file from "My Files" app I want to show my app under UIActivityViewController and when user tap on my App i want to open that document in my App.

burnsi
  • 6,194
  • 13
  • 17
  • 27
mahesh
  • 9
  • 3

1 Answers1

0

You're trying to share docs / PDF's but your NSExtensionActivationRule dictionary has an NSExtensionActivationSupportsImageWithMaxCount entry.

Can you change this to NSExtensionActivationSupportsFileWithMaxCount and see if this works (this is the documentation that I am referring to).

I'm sorry I cannot give a more categorical answer because your question is sort of unclear to me. If this doesn't help, could you clarify the below things:

  1. By "My Files app" are you referring to the Apple's 'Files' app, or is it a different 3rd-party app, or is it another app that you have built / are building?
  2. With your existing config (NSExtensionActivationSupportsImageWithMaxCount key) what is the behaviour you observe?
  3. Does the behaviour change when you use the NSExtensionActivationSupportsFileWithMaxCount key?

Hope this helps you.