openURL 在操作扩展中不起作用 [英] openURL not work in Action Extension

查看:40
本文介绍了openURL 在操作扩展中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加以下代码:

- (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];

}

在我创建 Action Extension 目标之后.但它不能工作.

after I create the Action Extension target. But it can not work.

我的目的是:当用户在 Photos.app(iOS 的默认 Photos.app 或称为画廊)中查看照片时,他单击共享按钮以启动我们的扩展视图.我们可以将图片从 Photos.app 传输到我自己的应用,然后在我的应用中处理或上传图片.

My purpose is that: when user view a photo in Photos.app (the iOS's default Photos.app or called gallery), and he click the share button to launch our extension view. We can transfer the image from Photos.app to my own app and deal or upload the image in my app.

我也尝试过CFBundleDocumentTypes",但它也无法工作.

I also try "CFBundleDocumentTypes" but it also can not work.

任何帮助将不胜感激.

推荐答案

这是设计使然.我们不希望自定义操作成为应用启动器.

This is by design. We don't want Custom Actions to become app launchers.

这篇关于openURL 在操作扩展中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆