sensorkit
Access research-grade sensor data using SensorKit for approved studies. Use when an app needs SensorKit entitlement setup, Research Sensor & Usage Data authorization, ambient light, recorded motion, device usage, keyboard metrics, visits, speech, face, wrist temperature, ECG, PPG, acoustic settings, or sleep-session data. Route ordinary motion to CoreMotion and health records/workouts to HealthKit.
Security Assessment
About sensorkit
SensorKit lets approved research apps record and fetch research-grade sensor data from iPhone and Apple Watch, covering signals such as ambient light, recorded motion, device and app usage, keyboard metrics, visits, speech metrics, face metrics, wrist temperature, heart rate, ECG, and PPG. Access is tightly restricted: an app must submit a research proposal to Apple, receive the com.apple.developer.sensorkit.reader.allow entitlement listing only approved sensors, use manual provisioning with an explicit App ID, and obtain per-sensor user consent through the system's Research Sensor & Usage Data sheet. This is deliberately not a general-purpose sensor API; the skill directs ordinary accelerometer, gyroscope, pedometer, and activity-recognition needs to CoreMotion, and health records and workouts to HealthKit. Two privacy safeguards shape the workflow: newly recorded data is held inaccessible for 24 hours so users can delete anything they do not want shared, and an app can reach at most 7 days of prior recorded data for an active sensor. Required Info.plist keys are NSSensorKitUsageDescription, NSSensorKitPrivacyPolicyURL, and a per-sensor NSSensorKitUsageDetail dictionary, where marking a sensor Required prompts the system to warn users who decline. The skill shows authorization through SRSensorReader, including requestAuthorization(sensors:) for batching multiple sensors, checking authorizationStatus before recording, and monitoring changes via the reader delegate's didChange callback. It provides a full catalog of available sensors grouped as device, app activity, user activity, and environment, mapping each SRSensor case to its sample type, for example .ambientLightSensor to SRAmbientLightSample, .electrocardiogram to SRElectrocardiogramSample, and .sleepSessions to SRSleepSession. Guidance on manual code-signing settings, recording and fetching data, SRDevice, common mistakes, and a review checklist rounds it out. It targets Swift 6.3 and iOS 26+, with reminders to verify newer sensors against their individual entitlement and usage-detail pages.
FAQ
Who is allowed to use SensorKit?
Only Apple-approved research studies. You submit a proposal (via researchandcare.org), and Apple grants the com.apple.developer.sensorkit.reader.allow entitlement for the approved sensors.
What are the 24-hour hold and 7-day limits?
Newly recorded data is inaccessible for 24 hours so users can delete data they do not want to share, and an app can access up to 7 days of prior recorded data for an active sensor.
Which Info.plist keys are required?
NSSensorKitUsageDescription (study purpose), NSSensorKitPrivacyPolicyURL (privacy policy link), and NSSensorKitUsageDetail (per-sensor explanations, where Required set to true prompts a warning if the user declines).
When should I use CoreMotion or HealthKit instead?
Use CoreMotion for ordinary accelerometer, gyroscope, pedometer, or activity-recognition features, and HealthKit for health records and workouts. SensorKit is only for approved research data collection.
How do I request and check authorization?
Use SRSensorReader.requestAuthorization(sensors:) to request multiple sensors at once, check reader.authorizationStatus before recording, and monitor changes via the delegate's sensorReader(_:didChange:) callback.
Install sensorkit
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
dpearson2699/swift-ios-skills