【问题标题】:iOS application runs after end of background taskiOS 应用程序在后台任务结束后运行
【发布时间】:2012-12-10 02:29:44
【问题描述】:

我制作了自定义 voip 应用程序。几乎一切都很好;但有时会重新启动应用程序。

From crash log:
Exception Type:  00000020
Exception Codes: 0xbad22222
Highlighted Thread:  4

SBUnsuspendLimit CryptTalkDev[24820] exceeded 15 wakes in 300 sec

Highlighted thread call stack:
Thread 4 name:  com.apple.NSURLConnectionLoader
Thread 4:
0   libsystem_kernel.dylib          0x35eab004 0x35eaa000 + 4100
1   libsystem_kernel.dylib          0x35eab1fa 0x35eaa000 + 4602
2   CoreFoundation                  0x355d93ec 0x3554c000 + 578540
3   CoreFoundation                  0x355d8124 0x3554c000 + 573732
4   CoreFoundation                  0x3555b49e 0x3554c000 + 62622
5   CoreFoundation                  0x3555b366 0x3554c000 + 62310
6   Foundation                      0x35094bb2 0x35084000 + 68530
7   Foundation                      0x35094a7a 0x35084000 + 68218
8   Foundation                      0x3512858a 0x35084000 + 673162
9   libsystem_c.dylib               0x329c872e 0x329ba000 + 59182
10  libsystem_c.dylib               0x329c85e8 0x329ba000 + 58856

此时没有传入流量 - 我从应用程序日志中检查过。

在几分钟前应用程序收到网络更改通知并开始在服务器上重新注册。后台任务开始保护它。在崩溃后台任务完成前一分钟。但是应用程序仍然运行 - 我在日志中看到它!

可能是什么原因?

附:今天检查了控制台:

Dec  4 13:57:36 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:57:36 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:57:46 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:57:46 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:57:56 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:57:56 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:06 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:06 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:16 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:16 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:27 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:27 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:37 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:37 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:47 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:47 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:57 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:58:57 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:07 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:07 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:17 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:17 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:27 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:27 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:37 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:37 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:47 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:47 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:57 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 13:59:58 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 14:00:08 unknown SpringBoard[51] <Warning>: Unable to deliver SBApplicationNotificationStateChanged notification to port com.apple.springboard.appstatechanged: (ipc/send) timed out
Dec  4 14:00:08 unknown SpringBoard[51] <Warning>: SBUnsuspendLimit CryptTalkDev[3925] exceeded 15 wakes in 300 sec
Dec  4 14:00:08 unknown SpringBoard[51] <Warning>: Forcing crash report of CryptTalkDev[3925]...
Dec  4 14:00:09 unknown ReportCrash[3956] <Notice>: Formulating crash report for process ReportCrash[3955]
Dec  4 14:00:09 unknown SpringBoard[51] <Error>: simulatecrash call failed with status (-308)
Dec  4 14:00:09 unknown SpringBoard[51] <Warning>: Finished crash reporting.

P.P.S. 今天在应用程序上运行 I/O 活动工具。 发现了两件事: 1)应用程序每10秒恢复一次,暂停100-200毫秒,然后再次恢复 2)iOS系统调用中有socket I/O;不是 SIP 信令套接字。 看起来它类似于 http://trac.pjsip.org/repos/ticket/1482

但难的是找到断开连接的 tcp 套接字...

【问题讨论】:

标签: objective-c ios cocoa-touch uiapplication


【解决方案1】:

已解决。 原因是后台模式的tcp连接准备不当。

对我来说正确的方式:

  1. 为 BSD 套接字创建一对流(我使用 bsd 套接字)
  2. 将两个流的 kCFStreamPropertyShouldCloseNativeSocket 设置为 kCFBooleanFalse
  3. 将两个流的 kCFStreamNetworkServiceType 设置为 kCFStreamNetworkServiceTypeVoIP

步骤 1) - 3) 在从服务器接收到第一个数据后运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-11
    • 2012-05-27
    • 2015-04-25
    • 1970-01-01
    相关资源
    最近更新 更多