我需要显示我的应用程序UIActivityViewController所有应用程序作为行动扩展(默认)

创build新的项目,并添加ActionExtension它的工作和行动活动中显示但行动扩展不显示在设备当我创build现有的应用程序(旧的应用程序,其中包含快速和Objective-C文件)我需要显示我的应用程序的行动扩展UiactivityController,但我无法显示在设备中的每个应用程序引用图像

此搜索图像2

***查询:在模拟器(照片应用程序)时,它显示,而不是在模拟器中的其他应用程序中显示,但是当我在设备中运行它不显示在照片应用程序和其他

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文档和其他链接

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

在扩展没有find任何相关的答案和我的行动扩展Plist文件(参考图片)

在这里输入图像说明

**我无法在UiactivityViewController中显示我的应用程序请帮助

嘿,我只回答我自己的问题。 现在我可以在UIActivityViewController中显示我的AppExtension

我再次参加了我的旧项目,并添加了Target – > Action Extension Newly

Xcode->文件 – >新build目标 – >select动作扩展 – >完成

要做的事情:

在Plist中添加如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> 

结果:

在这里输入图像说明

请参阅链接

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

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