博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS获取通话状态
阅读量:4111 次
发布时间:2019-05-25

本文共 1774 字,大约阅读时间需要 5 分钟。

1.首先引入CoreTelephony.framework

2.加入头文件

1
#         
import
 
<
CoreTelephony
/
CTCallCenter
.
h
>

3.功能实现

1        
2
3
4
CTCallCenter         
 
*
center
 
=
 
[
[
CTCallCenter
 
alloc
]
 
init
]
;
center
.
callEventHandler
 
=
 
^
(
CTCall
 
*
call
)
{
        
NSLog
(
@
"Call State : %@"
,
[
call
 
description
]
)
;
    
}
;

当电话打进来时,程序就会执行我们的block.

CTCall (0x1ab590) {
callState: [CTCallStateIncoming]
Call ID: [2B9E84A9-0F12-4539-AC8D-AF2A7ED7069E]
}
CTCall (0x183a00) {
callState: [CTCallStateDisconnected]
Call ID: [2B9E84A9-0F12-4539-AC8D-AF2A7ED7069E]
}
注:__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0)

转载地址:http://kposi.baihongyu.com/

你可能感兴趣的文章
leetcode----139. Word Break
查看>>
leetcode----142. Linked List Cycle II
查看>>
leetcode----143. Reorder List
查看>>
leetcode----144. Binary Tree Preorder Traversal
查看>>
leetcode----147. Insertion Sort List
查看>>
leetcode----148. Sort List
查看>>
leetcode----150. Evaluate Reverse Polish Notation
查看>>
leetcode----151. Reverse Words in a String
查看>>
leetcode----153. Find Minimum in Rotated Sorted Array
查看>>
leetcode----162. Find Peak Element
查看>>
leetcode----152. Maximum Product Subarray
查看>>
leetcode----165. Compare Version Numbers
查看>>
leetcode----166. Fraction to Recurring Decimal
查看>>
leetcode----173. Binary Search Tree Iterator
查看>>
leetcode----179. Largest Number
查看>>
leetcode----187. Repeated DNA Sequences
查看>>
leetcode----199. Binary Tree Right Side View
查看>>
leetcode----200. Number of Islands
查看>>
leetcode----201. Bitwise AND of Numbers Range
查看>>
leetcode----207. Course Schedule
查看>>