2013-04-03 49 views
1
TESTPRO_TEST[830] has active assertions beyond permitted time: 
     {(
      <BKProcessAssertion: 0x1fd48670> identifier: UIKitBackgroundCompletionTask process: TESTPRO_TEST[830] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:830 preventSuspend preventIdleSleep , 
      <BKProcessAssertion: 0x2083f190> identifier: UIKitBackgroundCompletionTask process: TESTPRO_TEST[830] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:830 preventSuspend preventIdleSleep 
     )} 
    <Warning>: Forcing crash report of DSC_TEST[830]... 
    <Warning>: Finished crash reporting. 
    [830] has active assertions beyond permitted time: 
     {(
      <BKProcessAssertion: 0x1fd48670> identifier: UIKitBackgroundCompletionTask process: [830] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:830 preventSuspend preventIdleSleep 
     )} 
    <Warning>: Forcing crash report of [830]... 
    <Error>: Multiple simulate crash requests for pid 830 
    <Warning>: Finished crash reporting. 
    <Warning>: pid_suspend failed for [830]: Unknown error: -1, Unknown error: -1 
    com.apple.launchd[1] (UIKitApplication:com.testPro.Test[0x4aff][830]) <Notice>: (UIKitApplication:com.testPro.Test[0x4aff]) Exited: Killed: 9 
    <Warning>: Application 'UIKitApplication:com.testPro.Test[0x4aff]' exited abnormally with signal 9: Killed: 9 
    �<Debug>: launchd[869] Builtin profile: container (sandbox) 
    <Debug>: launchd[869] Container: /private/var/mobile/Applications/3CF1EEC9-B6EF-45EA-999D-EBB9C02106EE (sandbox) 
    <Error>: Not saving crash log because we have reached the limit for logs to store on disk. Sync or otherwise clear logs from /var/mobile/Library/Logs/CrashReporter to save new logs. 
    <Error>: Could not save crash report to disk! 

當應用程序進入後臺進入後臺崩潰,我添加的代碼應用程序在iOS的

- (void) applicationDidEnterBackground:(UIApplication *) application 
{ 

    [UIApplication sharedApplication].applicationIconBadgeNumber = 0; 
    UIBackgroundTaskIdentifier bgTask = 0; 
    UIApplication *app = [UIApplication sharedApplication]; 
    bgTask = [app beginBackgroundTaskWithExpirationHandler: ^{ 
     [app endBackgroundTask:bgTask]; 
    }]; 

} 

當應用程序進入background.Can任何人幫助我解決這個碰撞發生崩潰?

回答

2

原因很明顯 - 它指向日誌 - 您的時間已過期。 Applications running background tasks have a finite amount of time in which to run them. (You can find out how much time is available using the backgroundTimeRemaining property.) If you do not call endBackgroundTask: for each task before time expires, the system kills the application.

我不認爲你應該在applicationDidEnterBackground:中嘗試將此方法調用到適當的位置(開始工作的位置)。您可以使用它來包裝長時間播放的流程,這些流程也可能以bkg工作。不要嚴格評判我的答案,這只是我的猜測,可能會成爲現實。

P.S.這裏有很好的解釋What are beginBackgroundTaskWithExpirationHandler and endBackgroundTask methods

+0

感謝您的回覆。但是應用程序在後臺運行的時間有限嗎? –

+1

這是一些蘋果常量,但事情是,你以一種錯誤的方式使用這種方法!你不應該在'applicationDidEnterBackground'中調用它,最好在開始某個任務之前調用它,並且不要忘記在最後調用'endBackgroundTask'。這裏有很好的解釋是什麼實際上'beginBackgroundTaskWithExpirationHandler' http://stackoverflow.com/questions/12071726/how-to-use-beginbackgroundtaskwithexpirationhandler-for-already-running-task-in – Stas

+1

在iOS7中,一個正常的應用程序有限的時間在背景中是3分鐘,即180秒,在iOS7之前是10分鐘,即600秒。 –