ATS警告但临时异常是否有效?

时间:2016-04-05 16:11:25

标签: ios app-transport-security network-security

我有一个奇怪的问题, 我一直得到App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.,但是我启用了一个例外,并打开了ATS的整个应用程序,但是我的偏好被Xcode忽略了,即使我的其他密钥正在使用中。

我想知道自己做错了什么,有人可以告诉我,如果我的钥匙出现任何严重错误吗?

<?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>AUTH_SERVER_URL</key>
    <string>https://$(Auth_Server_Url)</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>MKDirectionsRequest</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.apple.maps.directionsrequest</string>
            </array>
        </dict>
    </array>
    <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>0.1</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fr.cityzenmobility.drivers</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps</string>
            </array>
        </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>6</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>MKDirectionsApplicationSupportedModes</key>
    <array>
        <string>MKDirectionsModeCar</string>
        <string>MKDirectionsModeStreetCar</string>
        <string>MKDirectionsModeTaxi</string>
    </array>

以下是应该起作用的部分:

 <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <false/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>www.mysite.fr</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>

然后是 Info.plist 文件的结尾:

    <key>SERVERURL</key>
    <string>http://${Server_Url}</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Welcome</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
</dict>
</plist>

修改

我已经构建了一个全新的项目,具有完全相同的Info.plist。它起作用,因此问题不在于网络部分本身。

1 个答案:

答案 0 :(得分:0)

出于一些奇怪的原因,在完全重启Mac之后,项目的git克隆,项目和构建文件的完整清理以及iPhone,代码开始按预期运行。

我认为某些缓存文件行为不端......

相关问题