Skip to main content
The PhosraSDK Swift package provides on-device child safety enforcement for iOS using Apple’s FamilyControls, ManagedSettings, and DeviceActivity frameworks.

Overview

The SDK has a two-layer architecture:
  1. API Client — Communicates with the Phosra API to register devices, fetch compiled policies, submit enforcement reports, and acknowledge policy versions.
  2. Enforcement Engine — Translates the compiled policy document into native Apple framework calls to enforce content filters, screen time limits, web filtering, purchase controls, and more.

API Client

Handles device registration, policy sync, and reporting via the Phosra REST API.

Enforcement Engine

Maps policy rules to FamilyControls, ManagedSettings, and DeviceActivity calls.

Requirements

The FamilyControls entitlement must be approved by Apple before your app can enforce restrictions on-device. Request it early — approval typically takes 1-2 weeks.

Installation

The PhosraSDK Swift package is in private preview. Contact developers@phosra.com to receive the repository URL and access credentials. Once you have access, add it via Swift Package Manager:
Xcode

Quick Start

Device Registration

The registration flow requires parent authentication and produces a device-specific API key:
The RegisterDeviceRequest includes device metadata and capability declarations:

Policy Sync

Automatic Polling with PolicySyncManager

The PolicySyncManager handles periodic policy fetching with conditional requests:

Push-Based Sync (APNs)

For immediate policy refresh when a parent modifies rules, handle APNs silent push notifications:
The push notification payload:

Enforcement Engine

Each enforcer handles a specific policy section and maps it to the appropriate Apple framework.

Content Filter Enforcer

Uses ManagedSettings to control app access based on age ratings and block/allow lists.

Screen Time Enforcer

Uses DeviceActivity to monitor and limit screen time.

Web Filter Enforcer

Uses ManagedSettings web content filtering.

Purchase Enforcer

Social Enforcer

Notification Enforcer

Reporting

The SDK submits two types of reports to the Phosra API:

Enforcement Status Report

Sent after applying a policy, contains per-category results:

Screen Time Report

Aggregated daily usage data:

CompiledPolicy Structure

The compiled policy is fetched from GET /device/policy and contains all enforcement rules organized by section:

Supported Rule Categories

The 45 OCSS rule categories the iOS SDK maps to native framework primitives (of the 123 categories in the OCSS rule registry; the remainder are policy-only or census-enforced and carry no client-side Apple verb):

Content Rules

Time Rules

Purchase Rules

Social Rules

Web Rules

Privacy Rules

Monitoring Rules

Engagement Rules

Notification Rules

Legislation-Driven Rules

Compliance Rules

Parental / Legislative Rules

Troubleshooting

  • Ensure your app has the com.apple.developer.family-controls entitlement
  • The entitlement must be approved by Apple for distribution builds
  • For development, use the automatic provisioning profile in Xcode
  • Check that the device is not already managed by another FamilyControls app
  • Verify FamilyControls authorization status is .approved
  • ManagedSettingsStore changes are transactional; create a new store instance if the previous one has stale state
  • Check the device logs: log stream --predicate 'subsystem == "com.apple.ManagedSettings"'
  • The DeviceActivityMonitor extension must be a separate target in your Xcode project
  • Verify the extension’s bundle ID matches the App Group
  • Maximum of 20 concurrent DeviceActivitySchedule instances per app
This is expected behavior. When you pass sinceVersion, the server returns 304 if the policy has not changed. The SDK returns nil in this case — no action is needed.
  • Ensure Keychain Sharing capability is enabled if using app extensions
  • Use kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly (the SDK default) for device keys
  • On simulator, Keychain behavior may differ from physical devices
  • Provide a detailed description of your child safety use case in App Store Connect
  • Include screenshots showing the parent consent flow
  • Reference applicable legislation (COPPA, KOSA, etc.) in your review notes
  • Ensure your privacy policy covers data collected from child devices