我添加以下代码:
- (IBAction)done {
// Return any edited content to the host app.
// This template doesn't do anything, so we just echo the passed in items.
NSURL *url = [NSURL URLWithString:@"lister://today"];
[self.extensionContext openURL:url completionHandler:^(BOOL success) {
NSLog(@"fun=%s after completion. success=%d", __func__, success);
}];
[self.extensionContext completeRequestReturningItems:self.extensionContext.inputItems completionHandler:nil];
}
Run Code Online (Sandbox Code Playgroud)
在我创建Action Extension目标之后.但它无法奏效.
我的目的是:当用户在Photos.app(iOS的默认Photos.app或被调用的图库)中查看照片时,他点击分享按钮以启动我们的扩展视图.我们可以将Photos.app中的图像传输到我自己的应用程序,并在我的应用程序中处理或上传图像.
我也尝试"CFBundleDocumentTypes"但它也无法工作.
任何帮助将不胜感激.