Hello !
I know this question is getting old, but we're bumping into this issue as well.
After migrating to XCode 13, it became mandatory to set APPLICATION_EXTENSION_API_ONLY to true in build settings of our widget extension. However, as stated above, this renders the isProtectedDataAvailable property unavailable through UIApplication.shared
So I have 2 questions :
Is there any new way of accessing it cleanly with iOS 14 or 15 ?
In the meantime, is it acceptable to use this ugly hack or can this be seen as accessing private API & subject to app rejection 🥶 ?
func isProtectedDataAvailable() -> Bool {
let application = UIApplication.value(forKeyPath: #keyPath(UIApplication.shared)) as! UIApplication
return application.isProtectedDataAvailable
}
Thanks in advance
Bioche