본문 바로가기
프로그래밍 놀이터/iOS

[ios] CallKit - CallDirectoryExtension

by 돼지왕 왕돼지 2018. 2. 7.
반응형

 [ios] CallKit - CallDirectoryExtension


참조 : https://developer.apple.com/reference/callkit

addBlockingEntryWithNextSequentialPhoneNumber, addIdentificationEntryWithNextSequentialPhoneNumber, app extension, beginRequestWithExtensionContext, beginRequestWithExtensionContext, call blocking & identification, call directory extension, calldirectory, caller identification, callkit, cancelRequestWithError, CID, completeRequestReturningItems, completeRequestWithCompletionHandler, CXCallDirectoryExtensionContext, CXCallDirectoryManager, CXCallDirectoryProvider, extension status, Favorite, Framework, getEnabledStatusForExtensionWithIdentifier, incoming call, lockscreen, NSExtensionContext, openURL, Phone, reloadExtensionWithIdentifier, setting, sharedInstance, UX, View, VoIP, [ios] CallKit - CallDirectoryExtension, 수신차단, 최근 통화 뷰


-

CallKit framework 는 VoIP 앱이 일반 전화를 쓰는 것처럼 UX 를 가져갈 수 있게 해준다.

LockScreen 에서 incoming call 에 대한 view 를 보고 응답도 할 수 있다.

VoIP 에서 Favorite 과 최근 통화 뷰도 다룰 수 있다.



-

CallKit 은 app extension 형태( CallDirectory )로 수신차단과 발신자 정보 표시(caller identification) 기능을 사용할 수도 있다.



-

CXCallDirectoryExtensionContext : NSExtensionContext


- (void)addBlockingEntryWithNextSequentialPhoneNumber:(NSString*)phoneNumber;

- (void)addIdentificationEntryWithNextSequentialPhoneNumber:(NSString *)phoneNumber 

                                                      label:(NSString *)label;

- (void)completeRequestWithCompletionHandler:(void (^)(BOOL expired))completion;


(NSExtensionContext 함수)

- (void)completeRequestReturningItems:(nullable NSArray *)items completionHandler:(void(^ __nullable)(BOOL expired))completionHandler;

- (void)cancelRequestWithError:(NSError *)error;

- (void)openURL:(NSURL *)URL completionHandler:(void (^ __nullable)(BOOL success))completionHandler;



-

CXCallDirectoryManager

- (void)reloadExtensionWithIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *error))completion;

- (void)getEnabledStatusForExtensionWithIdentifier:(NSString *)identifier 

                                 completionHandler:(void (^)(CXCallDirectoryEnabledStatus enabledStatus, NSError *error))completion;

+ (CXCallDirectoryManager *)sharedInstance;



-

CXCallDirectoryProvider

- (void)beginRequestWithExtensionContext:(CXCallDirectoryExtensionContext *)context;



-

App 에서 CXCallDirectoryManager 의

- (void)reloadExtensionWithIdentifier:(NSString *)identifier completionHandler:(nullable void (^)(NSError *_Nullable error))completion;

함수를 부르면 Extension 의 Callback 이 불린다.


Setting -> Phone -> Call Blocking & identification 이 켜져 있다면 CallDirectoryExtension 의 - (void)beginRequestWithExtensionContext:(CXCallDirectoryExtensionContext *)context 함수가 불린다.



-

CXCallDirectoryManager 의

- (void)getEnabledStatusForExtensionWithIdentifier:(NSString *)identifier completionHandler:(void (^)(CXCallDirectoryEnabledStatus enabledStatus, NSError *_Nullable error))completion;

함수를 부르면 extension 의 status 를 알 수 있다.



-

Tutorial 이 잘 정리되어 있는 중국어 가이드.

http://colin1994.github.io/2016/06/17/Call-Directory-Extension-Study/




반응형

댓글