gpt4 book ai didi

ios - maxKeyCount 和 addPositiveDiagnosisKeys 如何交互?

转载 作者:行者123 更新时间:2023-12-01 21:56:20 25 4
gpt4 key购买 nike

我正在学习新的 Contact Tracing APIApple is releasing for iOS (in partnership with Google)。

我没有气喘吁吁maxKeyCount的关系CTExposureDetectionSession 上的属性(property),以及它与 addPositiveDiagnosisKeys: completion: 的关系方法。

我的理解

一个 CTExposureDetectionSession是允许应用程序要求框架开始尝试将已发布的诊断键列表与捕获的滚动接近标识符的本地数据库进行匹配的对象。

该应用程序将首先调用 activateWithCompletion:方法,然后调用 addPositiveDiagnosisKeys:一次或多次,最终通过调用 finishedPositiveDiagnosisKeysWithCompletion: 通知框架不再添加 key .

最后一次调用还将指示在检测完成时要运行的 block ,它将使用 CTExposureDetectionSummary 调用。对象通知设备已暴露于的诊断 key 的数量。

我不明白的是
maxKeyCount属性(property)文件说:

This property contains the maximum number of keys to provide to this API at once. This property’s value updates after each operation complete and before the completion handler is invoked. Use this property to throttle key downloads to avoid excessive buffering of keys in memory.



但是 addPositiveDiagnosisKeys:方法说:

Asynchronously adds the specified keys to the session to allow them to be checked for exposure. Each call to this method must include more keys than specified by the current value of <maxKeyCount>.


maxKeyCount似乎是最大值,但 addPositiveDiagnosisKeys:要求我用比最大值更多的键来调用它。

我是否应该使用先前发送的列表的 super 列表调用该方法? 这似乎不太适合“避免内存中键的过度缓冲”部分 - 如果我必须使用不断增长的键列表。
This property’s value updates after each operation complete 是什么意思?部分?

最佳答案

maxKeyCount 的文档缺少 不是 .

Android Contact Tracing API documentation有一个类似的接口(interface):

/**
* Provides a list of diagnosis keys for contact checking. The keys are to be
* provided by a centralized service (e.g. synced from the server).
*
* When invoked after the requestProvideDiagnosisKeys callback, this triggers a * recalculation of contact status which can be obtained via hasContact()
* after the calculation has finished. *
* Should be called with a maximum of N keys at a time. */
Task<Status> provideDiagnosisKeys(List<DailyTracingKey> keys);

/**
* The maximum number of keys to pass into provideDiagnosisKeys at any given * time.
*/
int getMaxDiagnosisKeys();

Paulw11建议在 a comment , maxKeyCount属性似乎是一个用于读取的值,该值统计在一次调用中要向 API 发送多少诊断 key 以执行匹配。

调用者应在每次调用之前重新检查该值,因为它可能会在每次调用后更新。
addPositiveDiagnosisKeys: 的固定文档那么,应该阅读:

Each call to this method must NOT include more keys than specified by the current value of <maxKeyCount>.

关于ios - maxKeyCount 和 addPositiveDiagnosisKeys 如何交互?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61197167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com