【发布时间】:2015-10-20 03:26:38
【问题描述】:
我已成功将NSAppTransportSecurity > NSExceptionDomains 添加到Info.plist 文件中,例如:
<key>NSAppTransportSecurity</key>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key><!-- your_remote_server.com / localhost --></key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
<!-- add more domain here -->
</dict>
但是有一个问题,我们有这个提供者,我们可以在其中获取 rss 提要并显示在应用程序中,而 NSAppTransportSecurity 正在阻止它们。我想在NSExceptionDomains 中动态添加当前活动的提供者并删除那些不活动的。
我知道在运行时修改Info.plist 是不行的,但我别无选择。
有人知道怎么做吗?
【问题讨论】:
-
不是不能修改Info.plist,而是不能。它是只读的。除了指定
NSAllowsArbitraryLoads键之外,您无法做任何您想做的事情。 -
@rmaddy,你的意思是我别无选择,只能手动一一添加?那么我们如何远程更改提供者呢?还有其他方法可以实现吗?
-
Info.plist 只能通过提交应用更新来更改。
-
@rmaddy,每次更新都更改提供程序,这就是我要避免的。我想我们真的别无选择吗?嗯..希望苹果对此有一些更新,或者可能支持至少两个 Info.plist 文件(一个是可编辑的)
标签: objective-c xcode ios9