iOS: I installed the Share Extension, but impossible to get the image selected from the gallery in my App

时间秒杀一切 提交于 2020-01-06 06:28:38

问题


I used that Tutorial but impossible to get the selected image in my App. I created with "New/File/Target", then I added a group in the "Capabilities". I can see the share icon when I go to the image gallery, but it does nothing when I click on the button.

Code Example:

- (BOOL)isContentValid {
    // Do validation of contentText and/or NSExtensionContext attachments here
    return YES;
}

- (void)didSelectPost {
    // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.

    // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
    [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];
}

- (NSArray *)configurationItems {
    // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
    return @[];
}

What I would like is after selecting the image(s), I click on the share button, I choose my app in the list, and then it opens my app with the image(s) retrieved.

I check that two examples in the Apple doc, but nothing's work:
Open With...
Uti from Apple

Here is what I did, but this technique works only from the mail app:

Do you have any idea?

来源:https://stackoverflow.com/questions/46562841/ios-i-installed-the-share-extension-but-impossible-to-get-the-image-selected-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!