Adding APPLICATION_EXTENSION_API_ONLY to the defines, only compile app extension unsafe code when the flag is false.
e.g.
_isGpuDisabled =
#if APPLICATION_EXTENSION_API_ONLY
NO
;#else
[UIApplication sharedApplication].applicationState == UIApplicationStateBackground;
#endif
Part of #124287