Sanju ju February 2016

I need to show my App in UIActivityViewController for All Applications as Action Extension(Default)

Created New Project and Added ActionExtension it worked and shows in Action Activities But Action Extension doesn't show in Device when i created for Existing App(Old App which contains swift and Objective-c Files) I need to show my App in Action Extension of UiactivityController but i am unable to show For Every Application in Device refer image

image1 image2

***Query : While in Simulator(Photos App) it shows and it Doesn't shows in Other Apps in Simulator but when i run in Device it Doesn't shows in both Photos App 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)!)
                            }

    //       strongImageView.image = image as? UIImage

                        }        

Answers


Sanju ju February 2016

Hey I am answering to my own question only . Now I am able to show my AppExtension in UIActivityViewController

I took my Old Project again and added Target -> Action Extension Newly

Xcode-> File -> create New Target -> select Action Extension -> Done

Things to do :

In Plist Added like shown in Png

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

Result:

enter image description here

Post Status

Asked in February 2016
Viewed 2,290 times
Voted 14
Answered 1 times

Search




Leave an answer