我的手机:iOS 5.1.1越狱使用Absynth2
我正在尝试做什么: 检测来电或拨打电话时...
好的,这是我的代码,我放在AppDelegate下面didEnterBackground,也试过didResignActive- 我没有得到任何错误,但我也没有得到任何结果..
callCenter = [[CTCallCenter alloc] init];
[callCenter setCallEventHandler:^(CTCall *call) {
NSDictionary *dict = [NSDictionary dictionaryWithObject:call.callState forKey:@"callState"];
[[NSNotificationCenter defaultCenter] postNotificationName:@"CTCallStateDidChange" object:nil userInfo:dict];
NSLog(@"state changed on call: %@", call);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callReceived:) name:CTCallStateIncoming object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callEnded:) name:CTCallStateDisconnected object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callConnected:) name:CTCallStateConnected object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callDial:) name:CTCallStateDialing object:nil];
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.谢谢!