I need to show my application in UIActivityViewController for all applications as an extension of the action (default)

I created a new project and added ActionExtension, it worked and was demonstrated in Action Action, but the Action Extension does not appear on the device when I created for the Existing App (an old application that contains fast and Objective-c files), I need to show my application in action UiactivityController extension, but I can’t show that for every application on the device the image is referenced

image1image2

*** Request: while working in the Simulator (application for photos) it is displayed, and it does not appear in other applications in the simulator, but when I run it on the device, it does not appear in the Photos application and others.

override func viewDidLoad() { super.viewDidLoad() // Get the item[s] we're handling from the extension context. // For example, look for an image and place it into an image view. // Replace this with something appropriate for the type[s] your extension supports. var imageFound = false for item: AnyObject in self.extensionContext!.inputItems { let inputItem = item as! NSExtensionItem for provider: AnyObject in inputItem.attachments! { let itemProvider = provider as! NSItemProvider if itemProvider.hasItemConformingToTypeIdentifier(kUTTypeImage as String) { // This is an image. We'll load it, then place it in our image view. weak var weakImageView = self.imageView itemProvider.loadItemForTypeIdentifier(kUTTypeImage as String, options: nil, completionHandler: { (image, error) in NSOperationQueue.mainQueue().addOperationWithBlock { if let strongImageView = weakImageView { if let imageURL = image as? NSURL{ strongImageView.image = UIImage(data: NSData(contentsOfURL: imageURL)!) }else{ strongImageView.image = image as? UIImage } } } }) imageFound = true break } } if (imageFound) { // We only handle one image, so stop looking for more. break } } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func done() { // Return any edited content to the host app. // This template doesn't do anything, so we just echo the passed in items. self.extensionContext!.completeRequestReturningItems(self.extensionContext!.inputItems, completionHandler: nil) } 

Apple Recommended Documentation and Other Links

http://code.tutsplus.com/tutorials/ios-8-how-to-build-a-simple-action-extension--cms-22794

on Extensions did not find an answer and the file Action Extension Plist (see image)

enter image description here

** I can not show my application in the UiactivityViewController. Please, help

+6
source share
1 answer

Hey, I only answer my question. Now I can show my AppExtension in UIActivityViewController

I took my old project again and added Target -> Action Extension Newly

How to add a goal?

Xcode -> File -> create New Target -> select action extension -> Done

What to do in .plist:

Added to Plist as shown in Png

http://i.stack.imgur.com/KBwdil.png

 <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> 

Result:

enter image description here

References

http://code.tutsplus.com/tutorials/ios-8-how-to-build-a-simple-action-extension--cms-22794

http://www.appcoda.com/tag/app-extension/

+9
source

Source: https://habr.com/ru/post/1242532/


All Articles