I’m trying to detect if the user is already in a phone call when applicationDidBecomeActive is called.
Using CTCallCenter’s callEventHandler will not work for this (though I’ve gotten it to function just fine), so I’m using the currentCalls property defined in CTCallCenter. I have the following function:
- (Boolean) currentlyInCall {
CTCallCenter *callCenter = [[CTCallCenter alloc]init];
if([callCenter currentCalls] == nil) {
return false;
}
else {
return true;
}
}
This does return the correct value if the user is already in a call or if they’re not… but only the first time the app is run after a clean install. After that this method will always return false–meaning currentCalls always returns nil–even if the user is actually in a call.
Force quitting the app does not help, and neither does restarting the device. Only reinstalling.
Any ideas? Does this happen on anyone else’s device?
If it matters, I’m using XCode 4 with automatic reference counting on OSX Lion and testing on a 3GS iPhone.
Turns out currentCalls was returning just fine. I had an issue elsewhere in my program that made it look like it wasn’t. Whoops.