首页 > 解决方案 > 调用CXCallDirectoryManager.reloadExtension时经常遇到'CXErrorCodeCallDirectoryManagerErrorCurrentlyLoading'错误7

问题描述

在 CallDirectory Manager 上调用 reloadExtension 时,我经常收到错误代码 7。并且扩展启用微调器将始终加载...

我正在使用 callkit 扩展将数据写入呼叫目录。我有 200-500 个联系人,它们保存到主机应用程序和扩展程序都使用的共享应用程序组中。

主机应用程序会将数据写入此文件。在扩展的 beginRequest 中,我将通过在 for 循环中调用 context.addIdentificationEntry 添加所有标识(数字-标签对)。我已经尝试过 autoreleasepool 并批量使用调度异步,但不起作用。

我有 3 个文件来存储要添加或删除的 NSArray 中的数据。

1. First one is a file for all contacts, which should be used when the request is not incremental.

2. Second file is the incremental add, which will be used when it is a incremental request.

3. Third file is the records need to be removed.
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *containerURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:self.groupIdentifier];
containerURL = [containerURL URLByAppendingPathComponent:@"CallDirectoryData"];
NSString* filePath = containerURL.path;
NSArray *list = [NSArray arrayWithContentsOfFile:filePath]; // list is already sorted.
for(NSDictionary *record in list) {
    [context.addIdentificationEntry [record valueForKey: @"phone"] forLabel: @"label"]
}

关于初始设置或增量最佳实践的任何建议?或者如何使加载时间可以接受?

标签: ioscallkit

解决方案


推荐阅读