2

我对 CTCallCenter 有一个很大的问题,如果你接到电话但从不接听电话,电话就会崩溃。然后音乐应该回来,但是evertyhing就死了。

这是代码的样子:

_callCenter = [[CTCallCenter alloc] init];
_callCenter.callEventHandler = ^(CTCall* call){

    if (call.callState == CTCallStateDialing || call.callState==CTCallStateIncoming) { 
        _shouldResumeSongIfConnectionIsAlive=NO;

        if([[TFAudioPlayer sharedAudioPlayer] status]==TFAudioPlayerStatusPlaying){
            [[TFAudioPlayer sharedAudioPlayer] pause];
            isAppWasPlaying=YES;

        }else isAppWasPlaying=NO;

    }else if(call.callState==CTCallStateDisconnected){

        if(isAppWasPlaying){
            [[TFAudioPlayer sharedAudioPlayer] playForcedFromWhereItStopped];
            _shouldResumeSongIfConnectionIsAlive=YES;
        }
    }
};

我找不到任何方法来处理用户不拿起电话的情况。CTCallCenter 只有我能看到的传入、断开连接、连接和拨号。

有人有线索吗?

编辑:

仅当我在未连接和调试手机上运行该应用程序时才会出现此问题。当对方挂断(未接电话)时,应用程序直接死机。

堆栈跟踪:

Date/Time:       2012-11-19 14:20:47.470 +0100
OS Version:      iPhone OS 5.1 (9B179)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xbbadbeef
Crashed Thread:  10

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x356bb004 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x356bb1fa mach_msg + 50
2   CoreFoundation                  0x372203ec __CFRunLoopServiceMachPort + 120
3   CoreFoundation                  0x3721f0ea __CFRunLoopRun + 818
4   CoreFoundation                  0x371a249e CFRunLoopRunSpecific + 294
5   CoreFoundation                  0x371a2366 CFRunLoopRunInMode + 98
6   GraphicsServices                0x320af432 GSEventRunModal + 130
7   UIKit                           0x33926e76 UIApplicationMain + 1074
8   My App                          0x0001e63c 0x1a000 + 17980
9   My App                          0x0001c268 0x1a000 + 8808

还!如果我使用 DEPLOY POSTPROCESSING = YES 运行应用程序,它不会崩溃。我不明白

4

0 回答 0