iOS共享扩展名不适用于图片网址 [英] iOS Share extension not working on image urls

查看:145
本文介绍了iOS共享扩展名不适用于图片网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用这些规则的共享扩展名:

I have a share extension that uses those rules:

<dict>
    <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
    <integer>1</integer>
    <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
    <integer>1</integer>
    <key>NSExtensionActivationSupportsImageWithMaxCount</key>
    <integer>10</integer>
    <key>NSExtensionActivationSupportsText</key>
    <integer>1</integer>
</dict>

它非常适合普通网站和图像,但我无法解析这样的图像网址:( http://www.zappos.com/images/z/3/3/5/4/0/3/3354034-p-2x. jpg ).我累了添加其他规则,但是当我使用Safari打开此网站并单击共享时,我的共享扩展名仍然不会出现.

It works perfectly for normal websites and images but I can't parse image urls like this : ( http://www.zappos.com/images/z/3/3/5/4/0/3/3354034-p-2x.jpg ). I tired to add other rules but still my share extension won't appear when I open this website with Safari and click share.

但是,如果我将规则设为TRUEPREDICICATE,则我的共享扩展名可以解析该网站.

But if I make rule TRUEPREDICATE, my share extension can parse the site.

我做错了什么? 谢谢

推荐答案

基于wj2061的答案,以下谓词将获取主机应用程序提供的所有附件.

Building off of wj2061's answer, the following predicate will grab any and all attachments supplied by the host app.

<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
    extensionItems,
    $extensionItem,
    SUBQUERY (
        $extensionItem.attachments,
        $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.item" ||
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.content"
    ).@count == $extensionItem.attachments.@count
    ).@count > 0
</string>

这篇关于iOS共享扩展名不适用于图片网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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