2012-12-03 244 views
0

我做了自定義的voip應用程序。幾乎一切都很好,但時間應用程序重新啓動。iOS應用程序在後臺任務結束後運行

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 

此時沒有傳入流量 - 我從應用程序日誌中檢查。

在幾分鐘之內應用程序收到網絡更改通知並開始在服務器上重新註冊。後臺任務開始保護它。在崩潰後臺任務完成前的一分鐘內。但是應用程序仍然運行 - 我在日誌中看到它!

可能是什麼原因?

P.S.今天檢查控制檯:

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系統調用中有套接字I/O;不是SIP信令套接字。 看起來它類似於 http://trac.pjsip.org/repos/ticket/1482

但難的是找到斷開連接的TCP套接字...

+0

檢查http://stackoverflow.com/questions/8746599/setkeepalivetimeout-ios-behavior-exceeded-15-wakes-in-300-sec – iDev

+0

此時沒有SIP流量。 – Dmytro

回答

0

解決。 原因是爲背景模式準備tcp連接不當。

適合我的方式:

  1. 創建對用於BSD socket流的(我使用BSD套接字)
  2. 設置kCFStreamPropertyShouldCloseNativeSocket到kCFBooleanFalse兩個流
  3. 設置kCFStreamNetworkServiceType到kCFStreamNetworkServiceTypeVoIP兩個流

步驟1)-3)在從服務器接收到第一數據之後運行。