What would be the best way to determine whether my app is used by students, teachers, or all other consumers? I would like my app to behave slightly different when used in an educational environment. For example, hide UI elements that would cause a parent gate to pop up, such as for IAP or external links.
The best approach is to let the distributors of your app determine the visibility of those features as part of its deployment within their organizaton. Business and educaton enviroments use a combination of Managed App Configuration and Mobile Device Management software to install apps and set the various properties that would otherwise need to be set by a user during on-boading or by administrators whom would have to touch every device.
Check out the Managed App Configuration sample here:
https://developer.apple.com/library/content/samplecode/sc2279/Introduction/Intro.html
-Mark