_BSMachError XCode 7 Beta

Solution 1:

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.

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.

In order to address this you will add the following to your App's .plist file:

  • You may want to alter your ATS Exception Dictionary to fit your needs

    <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>
    

More details to this solution can be found here or here The Apple Documentation for App Transport Security is worth reading too.

Solution 2:

I had the same two error messages. In my case, the errors were appearing when I called [[UIApplication sharedApplication] openURL:url] after the user selected a button in an open UIAlertController. I assumed the alert was trying to close at the same time I was trying to open the URL. So, I introduced a slight delay and the error message went away.

dispatch_after(0.2, dispatch_get_main_queue(), ^{
    [[UIApplication sharedApplication] openURL:url];
});

Not sure if this helps with your particular problem, but I thought it might be helpful to share.

Solution 3:

Change the Localization native development region key in your info.plist from en to United States

Solution 4:

Dismissing view controller prematurely might cause this.

[self dismissViewControllerAnimated:YES completion:NULL]; 
//<do something..>

This throws _BSMachErrors

vs

//<do something..>
[self dismissViewControllerAnimated:YES completion:NULL]; 

Now, the _BSMachError is gone.