Search code examples
iosobjective-cphone-callcore-telephony

Detect call status in iPhone app?


My app is recording audio as a feature, but while a call is connected and I open my app's record button, the app crashes.

I want to show an alert that the record can not work while a call is in progress.

How can I check the call's status on button click?


Solution

  • Create an instance of CTCallCenter and check whether its currentCalls has more than zero elements in it. You can also use its callEventHandler property to proactively disable and reenable the “record” button in your UI.