iOS开发,App获取来电状态

App上的操作,随时都可能被来电打断,有些场景就必须监听来电通知,可以查看CTCallCenter的状态。

官方文档:

CTCallCenter

CTCall

 

 

CTCall

The state of the cellular call. (read-only)

Declaration
OBJECTIVE-C
@property(nonatomic, readonly, copy) NSString *callState//来电状态
Discussion
A cellular call’s initial state is either CTCallStateDialing or CTCallStateIncoming. When the call is fully established for all parties involved, the state transitions to CTCallStateConnected. When the call is terminated, the state transitions to CTCallStateDisconnected.

Import Statement
OBJECTIVE-C
@import CoreTelephony;
Availability
Available in iOS 4.0 and later.


States of cellular calls; one of dialing, incoming, connected, or disconnected.

Declaration
OBJECTIVE-C
extern NSString const *CTCallStateDialing;//呼叫中。。。
extern NSString const *CTCallStateIncoming;//有电话打入
extern NSString const *CTCallStateConnected;//接通
extern NSString const *CTCallStateDisconnected;//挂断

发表评论

电子邮件地址不会被公开。 必填项已用*标注