kCFStreamErrorDomainSSL -9806怀疑ATS失败

时间:2017-02-08 00:59:02

标签: ios objective-c iphone firebase app-transport-security

一个〜8个月的应用程序突然停止正常启动,Xcode 10.2模拟器在启动时立即发出以下错误的空白屏幕:

CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork_Sim/CFNetwork-808.2.16/ProjectRuntime/CFNetworkInternal.h:481)
2017-02-08 00:29:37.223[99834:1670390] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)

断点位于下面的第3行,在AppDelegate.m的didFinishLaunchingWithOptions中已经存在了几个月:

[FIRApp configure];
[FIRDatabase database].persistenceEnabled = YES;
[[PropertyAPI sharedInstance] setFIRref: [[FIRDatabase database] reference]];

为清楚起见,上述代码数月未发生变化,2016年的设备以及所有iPad和iPhone模拟器均经过良好测试。

要调试可疑的ATS故障,如here所述,这是我在设置环境变量CFNETWORK_DIAGNOSTICS后从Log收到的信息:

2017-02-08 00:34:22.068 [APPNAME][2557] <Debug> [Firebase/Core][I-COR000001] Configuring the default app.
2017-02-08 00:34:22.077381 [APPNAME][2557:683996] <FIRAnalytics/INFO> Firebase Analytics v.3404000 started
2017-02-08 00:34:22.081 [APPNAME][2557:] <FIRAnalytics/INFO> Firebase Analytics v.3404000 started
2017-02-08 00:34:22.082159 [APPNAME][2557:683996] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2017-02-08 00:34:22.082 [APPNAME][2557:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2017-02-08 00:34:22.083642 [APPNAME][2557:683935] Firebase Crash Reporting: Successfully enabled
2017-02-08 00:34:22.085183 [APPNAME][2557:684000] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2017-02-08 00:34:22.085 [APPNAME][2557:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2017-02-08 00:34:22.085524 [APPNAME][2557:683992] CFNetwork diagnostics log file created at: /private/var/mobile/Containers/Data/Application/B94912CB-B7DB-4CA8-9D0A-28FFA268CB94/Library/Logs/CrashReporter/CFNetwork_[appID]_2557.nwlrb.log
2017-02-08 00:34:22.085600 [APPNAME][2557:683992] CFNetwork Diagnostics [3:1] 00:34:22.083 {
LoaderWhatToDo: (null)
       Request: <CFURL 0x1700d37f0 [0x1adb5fbb8]>{string = https://play.googleapis.com/log, encoding = 134217984, base = (null)}
   CachePolicy: 1
      WhatToDo: originload
   CreateToNow: 0.00201s
} [3:1]
2017-02-08 00:34:22.086847 [APPNAME][2557:684002] CFNetwork Diagnostics [3:2] 00:34:22.086 {
AddCookies Continue: request POST https://play.googleapis.com/log HTTP/1.1
       HTTPProtocol: Task: 5fd0c200
} [3:2]
2017-02-08 00:34:22.087305 [APPNAME][2557:684002] CFNetwork Diagnostics [3:3] 00:34:22.087 {
DiskCookieStorage Construction: Binary{ Disk Cookies: { /private/var/mobile/Containers/Data/Application/B94912CB-B7DB-4CA8-9D0A-28FFA268CB94/Library/Cookies/Cookies.binarycookies, <0 cookies in 0 domains> clean not writing } }
                     Accessing: <CFURL 0x1740baca0 [0x1adb5fbb8]>{string = file:///private/var/mobile/Containers/Data/Application/B94912CB-B7DB-4CA8-9D0A-28FFA268CB94/Library/Cookies/Cookies.binarycookies, encoding = 134217984, base = (null)}
                          Path: /private/var/mobile/Containers/Data/Application/B94912CB-B7DB-4CA8-9D0A-28FFA268CB94/Library/Cookies/Cookies.binarycookies
                Read from disk: <0 cookies in 0 domains>
                         Dirty: NO
                       Writing: NO
                        Policy: 2
} [3:3]
2017-02-08 00:34:22.087579 [APPNAME][2557:684002] CFNetwork Diagnostics [3:4] 00:34:22.087 {
DiskCookieStorage Journaling On: Binary{ Disk Cookies: { /private/var/mobile/Containers/Data/Application/B94912CB-B7DB-4CA8-9D0A-28FFA268CB94/Library/Cookies/Cookies.binarycookies, <0 cookies in 0 domains> clean not writing } }
                           File: <CFURL 0x1700bc7a0 [0x1adb5fbb8]>{string = file:///private/var/mobile/Containers/Data/Application/B94912CB-B7DB-4CA8-9D0A-28FFA268CB94/Library/Cookies/Cookies.binarycookies, encoding = 134217984, base = (null)}
} [3:4]
2017-02-08 00:34:22.087978 [APPNAME][2557:684002] CFNetwork Diagnostics [3:5] 00:34:22.087 {
HTTPCookieStorage::copyCookiesForURL: <CFHTTPCookieStorage 0x170091440 [0x170091450]>
                         Request URL: https://play.googleapis.com/log
                    MainDocument URL: NONE
} [3:5]
2017-02-08 00:34:22.088430 [APPNAME][2557:684002] CFNetwork Diagnostics [3:6] 00:34:22.088 {
Protocol Enqueue: request POST https://play.googleapis.com/log HTTP/1.1
         Request: <CFURLRequest 0x1701bc7e0 [0x1adb5fbb8]> {url = https://play.googleapis.com/log, cs = 0x0}
         Message: POST https://play.googleapis.com/log HTTP/1.1
         Sending: dict [6] {
                      Content-Encoding: gzip
                                Accept: */*
                          Content-Type: application/x-www-form-urlencoded
                        Content-Length: 225
                       Accept-Language: en-gb
                       Accept-Encoding: gzip, deflate
                  }
} [3:6]
2017-02-08 00:34:22.088607 [APPNAME][2557:684002] CFNetwork Diagnostics [3:7] 00:34:22.088 {
SocketStream IO Logging: (null)
} [3:7]
2017-02-08 00:34:22.088930 [APPNAME][2557:684002] 2557: CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork-808.3/ProjectRuntime/CFNetworkInternal.h:481)
2017-02-08 00:34:22.089324 [APPNAME][2557:684000] CFNetwork Diagnostics [3:8] 00:34:22.089 {
TCP Connection Start: (null)
          Connection: 0x174188130
       Connection ID: 1
} [3:8]
2017-02-08 00:34:22.110: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2017-02-08 00:34:22.110: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2017-02-08 00:34:22.110441 [APPNAME][2557:684000] CFNetwork Diagnostics [3:9] 00:34:22.110 {
TCP Connection Connected: (null)
              Connection: 0x174188130
           Connection ID: 1
                   Error: 0
} [3:9]
2017-02-08 00:34:22.127949 [APPNAME][2557:683992] CFNetwork Diagnostics [3:10] 00:34:22.127 {
Authentication Challenge: (null)
                  Loader: <CFMutableURLRequest 0x1741bc000 [0x1adb5fbb8]> {url = https://play.googleapis.com/log, cs = 0x0}
               Challenge: challenge space https://play.googleapis.com:443/, ServerTrustEvaluationRequested (Hash 9c5b8dc48d973537)
} [3:10]
2017-02-08 00:34:22.173: <FIRMessaging/INFO> FIRMessaging library version 1.2.0
2017-02-08 00:34:22.177225 [APPNAME][2557:683992] CFNetwork Diagnostics [3:11] 00:34:22.176 {
LoaderWhatToDo: (null)
       Request: <CFURL 0x1700d5540 [0x1adb5fbb8]>{string = https://device-provisioning.googleapis.com/checkin, encoding = 134217984, base = (null)}
   CachePolicy: 0
      WhatToDo: originload
   CreateToNow: 0.00031s
} [3:11]
2017-02-08 00:34:22.177736 [APPNAME][2557:684002] CFNetwork Diagnostics [3:12] 00:34:22.177 {
AddCookies Continue: request POST https://device-provisioning.googleapis.com/checkin HTTP/1.1
       HTTPProtocol: Task: 5fd18ba0
} [3:12]
2017-02-08 00:34:22.177879 [APPNAME][2557:684002] CFNetwork Diagnostics [3:13] 00:34:22.177 {
HTTPCookieStorage::copyCookiesForURL: <CFHTTPCookieStorage 0x170091440 [0x170091450]>
                         Request URL: https://device-provisioning.googleapis.com/checkin
                    MainDocument URL: NONE
} [3:13]
2017-02-08 00:34:22.178417 [APPNAME][2557:684002] CFNetwork Diagnostics [3:14] 00:34:22.177 {
Protocol Enqueue: request POST https://device-provisioning.googleapis.com/checkin HTTP/1.1
         Request: <CFURLRequest 0x1701bd500 [0x1adb5fbb8]> {url = https://device-provisioning.googleapis.com/checkin, cs = 0x0}
         Message: POST https://device-provisioning.googleapis.com/checkin HTTP/1.1
         Sending: dict [5] {
                               Accept: */*
                       Content-Length: 274
                         Content-Type: application/json
                      Accept-Language: en-gb
                      Accept-Encoding: gzip, deflate
                  }
} [3:14]
2017-02-08 00:34:22.182617 [APPNAME][2557:684002] 2557: CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork-808.3/ProjectRuntime/CFNetworkInternal.h:481)
2017-02-08 00:34:22.183535 [APPNAME][2557:684000] CFNetwork Diagnostics [3:15] 00:34:22.182 {
TCP Connection Start: (null)
          Connection: 0x1741886e0
       Connection ID: 2
} [3:15]
2017-02-08 00:34:22.200: <FIRMessaging/WARNING> FIRMessaging AppDelegate proxy enabled, will swizzle app delegate remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
(lldb)

但与有用的link (already mentioned above)不同,我没有看到它在上述文章中描述的“潜在错误代码”:

  

虽然此错误不包含描述,但我们看到了   基础错误代码是-1202而不是-9824。

在上面的控制台备注中,我只能看到几个空值,我不明白其含义:

  

TCP连接已连接:( null)

  

SocketStream IO Logging :( null)

  

LoaderWhatToDo:(null)

经过相当长的一段时间后,我没有在这方面取得进展,欢迎有人提供建议或认识到这里发生的任何帮助。

为了完整起见,我添加了NSAppTransportSecurity dict的info.plist详细信息:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>play.googleapis.com</key>
            <dict>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <string>YES</string>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>device-provisioning.googleapis.com</key>
            <dict>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <string>YES</string>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>

编辑:

谢谢@Wottle。正确猜测:事情发生了变化。单行:应用程序初始化方法中的递归调用(在第一次安装期间设置应用程序内的“默认用户设置”)创建了超时。 Apple应用程序审核表明它可能是ATS网络问题(也许是因为它在网络登录期间超时?)。我跟着并为自己创造了一场野鹅追逐。我需要提出另一个查询,因为上述诊断中的某些网络错误仍然出于某种原因。这是我的newly-raised question

0 个答案:

没有答案