SSL Connection Error with Swift

2019-06-13 19:11发布

问题:

I am frustrated with this new error that I cannot somehow figure out.

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9800)
HTTP load failed (error code: -1200 [3:-9800])
Optional("An SSL error has occurred and a secure connection to the server cannot be made.")

Below is the info.plist

<key>NSAppTransportSecurity</key>

I have configured godaddy ssl in tomcat and only allowed tls1.2+ in httpd. I do not see why I am getting this error. Please help me figure out this problem and understand why this happens.

When I do nscurl --ats-diagnostics https://myserver:port#, I get

---
TLSv1.3 with PFS disabled and insecure HTTP allowed
2018-05-14 23:15:07.512 nscurl[36044:8746632] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9800)
Result : FAIL
---

If I figure this out, I think everything else will work. If you know anything about this, please help me out.

I do not want to add arbitrary load. I do not have a proper reason for this, but many posts say that this is a temporary solution that has bad impacts on security.

If more information is needed, please leave a comment. Thank you for your time and help.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>SOMETHING</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb1787966001498993</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>1787966001498993</string>
    <key>FacebookDisplayName</key>
    <string>MathMatch</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <key>NSPhotoLibraryUsageDescription</key>
    <string></string>
    <key>UIAppFonts</key>
    <array>
        <string>Brandon_bld.otf</string>
        <string>NotoSans-Regular.ttf</string>
        <string>DINPro_Regular.ttf</string>
    </array>
    <key>UIBackgroundModes</key>
    <array>
        <string>remote-notification</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UIRequiresFullScreen</key>
    <true/>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>