审查 HealthKit 代码的授权模式、查询使用、后台传递及数据类型处理。适用于审查包含 import HealthKit, H... 的代码
Issue TypeReferenceHKHealthStore, permissions, status checks, privacyreferences/authorization.mdHKQuery types, predicates, anchored queries, statisticsreferences/queries.mdBackground delivery, observer queries, completion handlersreferences/background.mdHKQuantityType, HKCategoryType, workouts, unitsreferences/data-types.md
HKHealthStore.isHealthDataAvailable() called before any HealthKit operationsrequestAuthorization completion handler not misinterpreted as permission grantedHKObjectQueryNoLimit used only with bounded predicatesHKStatisticsQuery used for aggregations instead of manual summingcompletionHandler() always called (use defer)application(_:didFinishLaunchingWithOptions:)count/min for heart rate)deinitenableBackgroundDelivery -> background.mdRun in order. Do not state a finding in a later step until the pass condition for the current step is satisfied (each pass condition is answerable from the codebase under review).
HealthKit, HKHealthStore, or HK* APIs (or state clearly that the diff touches none).isHealthDataAvailable() before HealthKit use, or document why omission is acceptable for the scoped code; cite where HKHealthStore is created or injected.requestAuthorization / getRequestStatusForAuthorization, cite handler branches per references/authorization.md (e.g. success does not prove read access); do not infer read permission from authorizationStatus alone.HKObjectQueryNoLimit only with a bounded predicate); for totals/aggregates, cite HKStatisticsQuery / collection vs manual summing per references/queries.md.HKObserverQuery or enableBackgroundDelivery appears, cite where the observer is started/stopped and where background delivery is registered; cite entitlements/Info.plist or flag missing config per references/background.md. If absent, Pass: one line “no observer/background in scope.”stop()/ deinit for long-running queries per checklist above.isHealthDataAvailable() checked before creating HKHealthStore?