问题描述
当我在 Xcode7 和 Swift2 中运行我的代码时,在通过 push segue 呈现视图控制器后出现以下错误:
I am getting the following error when I am running my code in Xcode7 with Swift2, after presenting a view controller through a push segue:
_BSMachError: (os/kern) invalid capability (20)
_BSMachError: (os/kern) invalid name (15)
其他 SO 文章都没有解决,有人知道这个问题吗?
The other SO articles had no resolution, does anyone know about this issue?
推荐答案
虽然这个问题似乎作为一个错误持续存在并且很可能会被修复,但它源于新的应用传输安全在 iOS 9 中实现.
Although this problem seems to persist as a bug and will likely be fixed, it stems from the new App Transport Security that has been implemented in iOS 9.
如果您的应用程序从 Web 服务器提取数据,为了填充您将要呈现的视图控制器,您可以通过验证/授予访问权限来解决这些错误到您要从中提取的特定站点.
If your application pulls data from a web server, in order to populate the View Controller that you will be presenting, you can resolve these errors by verifying/granting access to the particular site(s) you're pulling from.
您可能想要更改ATS 异常字典以满足您的需要
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>testdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<false/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
</dict>
</dict>
可以找到此解决方案的更多详细信息此处 或这里应用传输安全的 Apple 文档strong> 也值得一读.
More details to this solution can be found here or hereThe Apple Documentation for App Transport Security is worth reading too.
这篇关于_BSMachError XCode 7 Beta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!