ios - 调用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"]
}
关于初始设置或增量最佳实践的任何建议?或者如何使加载时间可以接受?
解决方案
推荐阅读
- docker - 在 Docker Compose 中设置 CPU 限制
- mongodb - 一个 pod 中的 Springboot 应用程序无法通过 Openshift 连接到另一个 pod 上的 mongodb
- html - 如何在 HTML/CSS 的列表( ul > li )中对齐图像?
- reactjs - TypeError:fs.readFileSync 不是函数
- ruby-on-rails - 文件未在创建时附加,但在 zendesk 更新时附加
- javascript - 排序算法在找到正确的条件时停止
- php - 如何在单个数组中创建多个数组值
- python - 使用 python 执行 SQL 查询时语法无效
- android - 在发布模式下登录 react-native?
- python-sphinx - 如何在 sphinx-doc 的 restructuredtext 中指定阿拉伯语文本?