【发布时间】:2016-03-10 01:50:16
【问题描述】:
有时我的应用会在启动时崩溃。
似乎与后台 NSURL Session Activity 失败有关。此消息在 Crashlytics 日志中的出现相当一致:
_block_invoke line 233 $ Error Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service"
我不知道如何在 xCode 中调试此问题,因为我无法在我的测试设备连接到我的计算机时导致它发生。
我没有在我的应用程序中使用 KVO;也许这是 AFNetworking 本身的问题?
以下是 Crashlytics 报告的崩溃消息:
Fatal Exception: NSInternalInconsistencyException
An instance 0x14f97ef00 of class __NSCFBackgroundDataTask was deallocated while
key value observers were still registered with it.
Current observation info: <NSKeyValueObservationInfo 0x14f97f320> ( <NSKeyValueObservance 0x14f841ea0: Observer: 0x14e777340, Key path: countOfBytesReceived, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x14e650010> <NSKeyValueObservance 0x14e6e1770: Observer: 0x14e777340, Key path: countOfBytesExpectedToReceive, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x14f81c090> <NSKeyValueObservance 0x14f80e030: Observer: 0x14e777340, Key path: countOfBytesSent, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x14f97e880> <NSKeyValueObservance 0x14e5ca9c0: Observer: 0x14e777340, Key path: countOfBytesExpectedToSend, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x14f97cf20> )
任何帮助将不胜感激。
【问题讨论】:
-
我认为这可能是由重复的 GET 请求引起的。
-
我认为这将在他们发布 AFNetworking 3.1.1 时得到修复(3.1.0 是当前版本。)我们将向后移植这个修复:github.com/AFNetworking/AFNetworking/commit/…
-
添加这个以防它帮助其他人找到这个 SO 问题
标签: ios key-value-observing afnetworking-3