简体   繁体   English

忽略应用传输安全

[英]Ignoring App Transport Security

For iPhone 6S PLUS simulator in debug area I received the following message: 对于调试区域中的iPhone 6S PLUS模拟器,我收到以下消息:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. 由于不安全,App Transport Security阻止了明文HTTP(http://)资源加载。 Temporary exceptions can be configured via your app's Info.plist file. 可以通过应用程序的Info.plist文件配置临时异常。

I only have a social share button implemented via SLComposeViewController. 我只有一个通过SLComposeViewController实现的社交共享按钮。 Inside the social share button I use an HTTP. 在社交分享按钮中,我使用HTTP。 That's HTTP is for the user to share their scores with their social accounts. HTTP是供用户与社交帐户共享分数的。 Even though i'm receiving the above message, the sharing still works as it's supposed to. 即使我收到上述消息,共享仍然可以正常进行。

So can I Ignore the App Transport Security issue and just send the app for app store review anyways? 因此,我是否可以忽略App Transport Security问题,而只是将其发送给App Store进行审查? If I ignore it, would my app get rejected also? 如果我忽略它,我的应用程序也会被拒绝吗?

Add Below Code to your Info.plist File and it will works 将以下代码添加到您的Info.plist文件中,它将起作用

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Most social urls have an HTTPS equivalent. 大多数社交网址都具有HTTPS等效项。 Can you try and use the HTTPS url to share the scores? 您可以尝试使用HTTPS网址共享分数吗? This will eliminate the warning that you receive. 这将消除您收到的警告。

If you can't use an HTTPS url, the other solution is to configure an exception to the rule in your info.plist. 如果您不能使用HTTPS网址,则另一种解决方案是在info.plist中配置该规则的例外。 This essentially will ignore the App Transport Security rule for the specified urls. 对于指定的网址,这实际上将忽略“应用程序传输安全性”规则。

It's also possible to turn off the warning for all urls (also via the info.plist). 也可以关闭所有网址的警告(也可以通过info.plist)。 However this is not recommended, and if you don't have a good reason to do so, the App Store may reject your app. 但是,不建议这样做,如果您没有充分的理由这样做,则App Store可能会拒绝您的应用程序。

Have a read through: info.plist reference for more details. 请通读: info.plist参考以获取更多详细信息。

I hope that helps. 希望对您有所帮助。

Viraj's solution will work however it is a work around, I would advise you to take a look here for some better solutions. Viraj的解决方案可以工作,但是可以解决,我建议您在这里查看一些更好的解决方案。 Hope that helped :) 希望有帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM