0

My app opens images and I am making it available as a system wide Image More Actions menu with a NSExtension.

This works using a UIViewController that conforms to ShareExtensionViewController. The problem is the view controller runs as a sub-window inside the app sharing the image, and I need my app to run full screen like normal.

In other words, I just want it to pass my app an image and run the app otherwise as usual. Do I just need to make it handle image URLs? Should I use an NSExtension or something different?

I know it is possible since there are apps that do this.

Here is my extension info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <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.share-services</string>
    </dict>
</dict>
</plist>

ViewController:

@objc(ShareExtensionViewController)
class ShareViewController: UIViewController {

    override func viewWillAppear(_ animated: Bool) {
        view.backgroundColor = .gray
    }

    private func handleSharedFile() {}
}

Edit:

It seems using com.apple.services for the NSExtensionPointIdentifier seems to do what I want, but I don't know how to set up a class for it and I can't find an example.

Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58

0 Answers0