ios - 为什么会有这么多canOpenURL?
<p><p>从 <a href="https://doc.open.alipay.com/doc2/detail?treeId=54&articleId=103419&docType=1" rel="noreferrer noopener nofollow">https://doc.open.alipay.com/doc2/detail?treeId=54&articleId=103419&docType=1</a> 运行 <code>AlipaySDK</code> 演示时,发生了一些奇怪的事情。 </p>
<p>从xcode中的日志输出来看,有10多条日志要说</p>
<blockquote>
<p>-canOpenURL: failed for URL: "momochs://" - error: "This app is not allowed to query for scheme momochs</p>
</blockquote>
<p>demo中没有源码可以通过简单的搜索打印出来。并且静态库只是付款,根据我的理解不应该做这样的检查。 </p>
<p>这里的问题是弄清楚为什么会发生这种情况,或者演示或其他设置有什么问题? </p>
<blockquote>
<p>2016-03-02 15:58:55.998 AliSDKDemo -canOpenURL: failed for URL: "momochs://" - error: "This app is not allowed to query for scheme momochs"
2016-03-02 15:58:55.999 AliSDKDemo -canOpenURL: failed for URL: "tenpay://" - error: "This app is not allowed to query for scheme tenpay"
2016-03-02 15:58:55.999 AliSDKDemo -canOpenURL: failed for URL: "com.icbc.iphoneclient://" - error: "This app is not allowed to query for scheme com.icbc.iphoneclient"
2016-03-02 15:58:56.000 AliSDKDemo -canOpenURL: failed for URL: "wx2654d9155d70a468://" - error: "This app is not allowed to query for scheme wx2654d9155d70a468"
2016-03-02 15:58:56.000 AliSDKDemo -canOpenURL: failed for URL: "meituan0000://" - error: "This app is not allowed to query for scheme meituan0000"
2016-03-02 15:58:56.000 AliSDKDemo -canOpenURL: failed for URL: "sinaweibo://" - error: "This app is not allowed to query for scheme sinaweibo"
2016-03-02 15:58:56.001 AliSDKDemo -canOpenURL: failed for URL: "dianping://" - error: "This app is not allowed to query for scheme dianping"
2016-03-02 15:58:56.001 AliSDKDemo -canOpenURL: failed for URL: "diditaxi://" - error: "This app is not allowed to query for scheme diditaxi"
2016-03-02 15:58:56.002 AliSDKDemo -canOpenURL: failed for URL: "cn.12306://" - error: "This app is not allowed to query for scheme cn.12306"
2016-03-02 15:58:56.002 AliSDKDemo -canOpenURL: failed for URL: "mtxx://" - error: "This app is not allowed to query for scheme mtxx"
2016-03-02 15:58:56.002 AliSDKDemo -canOpenURL: failed for URL: "youku://" - error: "This app is not allowed to query for scheme youku"
2016-03-02 15:58:56.003 AliSDKDemo -canOpenURL: failed for URL: "baidumap://" - error: "This app is not allowed to query for scheme baidumap"
2016-03-02 15:58:56.003 AliSDKDemo -canOpenURL: failed for URL: "iosamap://" - error: "This app is not allowed to query for scheme iosamap"</p>
</blockquote></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><blockquote>
<p>Why so many canOpenURL ?</p>
</blockquote>
<p>因为他们想知道安装了哪些应用程序,直到 iOS8 这是一个很难知道你安装了哪些应用程序的技巧,他们基本上有一个他们想知道的应用程序方案列表,所以他们会连续 <code>canOpenURL</code> 调用每个应用方案,然后收集数据并将其发送回他们的服务器以用于他们需要的任何目的。</p>
<p>谢天谢地,这在 iOS9 中不再允许,因为您需要提供您的应用将执行 <code>canOpenURL</code> 调用的方案列表,调用不在您的 <code>info.plist 中的 url 方案</code> 将导致您看到该日志警告</p>
<blockquote>
<p>The odd thing is I got log information as below, but can't find any
source code to print out such things.</p>
</blockquote>
<p>我看到的 SDK 不是开源的,所以你无法查看他们的代码,代码在静态库 <code>*.a</code> 文件中</p>
<blockquote>
<p>Just wonder how can they do this without source code ? Any technology to >achieve this ? thanks</p>
</blockquote>
<p>没什么特别的,如果你编写一个项目并将其构建为一个静态库,你将在 <code>.a</code> 文件中获得编译后的源代码,你可以将其导入其他项目并在那里使用,如只要你有正确的头文件,支付宝就是这样做的</p>
<p>希望这可以消除困惑,我建议保持原样,不要让他们完成这样的特技。</p>
<p>你总是可以将这些方案的列表添加到你的 <code>info.plist</code> 中,但是你必须向苹果自己解释为什么你需要打开这么多应用程序,这又是一个非常糟糕的主意,只需忽略它,您就可以开始了!</p></p>
<p style="font-size: 20px;">关于ios - 为什么会有这么多canOpenURL?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/35741601/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/35741601/
</a>
</p>
页:
[1]