Use development mode to test your app without a Managed Apple ID.
When you distribute your ClassKit enabled app through the App Store, it runs in production mode. In this mode, ClassKit shares data with Schoolwork on the device, and also with other devices through iCloud—for example, so that assignments made on a teacher’s device can be transmitted to students’ devices, or so that progress reported by a student returns to the teacher that made the assignment. To define these roles and enable these connections, users must be signed in to devices with Managed Apple IDs (MAIDs) issued by an educational institution enrolled in Apple School Manager.
During development, you might not have access to users with MAIDs. Instead, you run your app in development mode. In this mode, which Xcode enables by default, you manually set the user’s role in your device Settings, and all ClassKit data remains stored locally on your device. Nothing is sent to iCloud, and so a MAID isn’t required. However, the ClassKit API behaves just as it does in production mode, so that you can test your ClassKit adoption.
Choose a Role in the ClassKit Developer Settings
After you install Schoolwork on an iOS device, new developer settings appear that let you control ClassKit development mode behavior. Go to Settings > Developer on the device and choose ClassKit API.
In the view that appears, choose either a teacher or student role for the device. The role you choose changes how ClassKit routes data, as described in About ClassKit and User Roles.
You can switch back and forth between the teacher and student roles as needed. For example, begin as a teacher and run your app to establish your assignable content. Then create an assignment with Schoolwork. Next, switch to student mode and complete the assignment in your app. Finally, switch back to teacher mode to see the reported student progress. If you want to start over, tap Reset Development Data, shown just below the role selection in the screenshot above, to purge the student and teacher databases.
Flush Cached ClassKit Data After Changing Roles
Because both teacher and student data are stored on a single device in development mode, each in a dedicated database, it’s important to flush any cached ClassKit data from memory after you change roles. Otherwise, you might be working with cached items from the teacher’s database after changing to the student role, or vice versa. This results in undefined behavior.
The easiest way to flush data is to restart your app. That forces ClassKit to reload or recreate data when you begin operating in the new role, rather than relying on possibly stale data in memory.
Optionally, Test in Production Mode with MAIDs
You can fully qualify your ClassKit adoption using development mode, as explained above. But if you do need to launch your app from Xcode in an environment where users are logged in with MAIDs, you can choose production mode manually.
When you enable the ClassKit capability in Xcode for your app, Xcode adds a
Class entitlement to the build, and sets its value to
development. This enables ClassKit, and it also opts in your app to ClassKit’s development features by default. As part of the App Store submission process, Xcode automatically changes the entitlement’s value to
production. That deactivates development mode behavior for instances of the app distributed through the App Store.
To override this behavior and choose production mode during development, modify the entitlement manually. Do this by opening your app’s entitlements file, and setting the ClassKit entitlement’s value to
In production mode, the ClassKit API behaves exactly the same from your app’s point of view as it did in development mode, but the framework only interacts with Schoolwork and the network if you sign in to the device with a MAID. If you don’t sign in with a MAID in production mode, ClassKit treats you as an unmanaged user, silently dropping any data you report through the API.