[英]iOS phone app: third party app integration like Viber/WhatsApp
以下是在本機應用程序中激活此選項的方法:
首先,必須使用 CallKit 框架。 iOS 將自動生成這些選項(稱為句柄)。 負責該財產是supportedHandleTypes
與CXHandleTypePhoneNumber
手柄類型。
CXProviderConfiguration * config = [[CXProviderConfiguration alloc] initWithLocalizedName:NSLocalizedString(@"myAppName", @"")];
config.supportedHandleTypes = [NSSet setWithObjects:@(CXHandleTypePhoneNumber), nil];
調用此配置后,將出現本機應用程序中的句柄。 我在我的應用程序委托中調用了這個:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
如果視頻句柄也應該出現,那么配置應該是:
config.supportsVideo = YES;
還有另外兩種句柄類型CXHandleTypeGeneric
和CXHandleTypeEmailAddress
,但我無法弄清楚這些句柄引起了什么變化。 如果您知道他們在做什么,請發表評論。
ps:我之前用的是CXHandleTypeGeneric
,我的應用程序看不到句柄。 一旦我將其更改為CXHandleTypePhoneNumber
,該句柄就會自動添加到聯系人詳細信息中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.