UIApplication.sharedApplication not available

后端 未结 3 1916
甜味超标
甜味超标 2020-12-14 01:55

I\'m trying to get a reference to my app delegate from a UIViewController but I keep getting an this error message:

\'sharedApplication()\' is unavail

3条回答
  •  悲哀的现实
    2020-12-14 02:53

    Problem solved. I've been to the Build Settings of my app again and stumbled over

    Require Only AppExtension-Safe API
    

    all set to YES. The default though is NO. When I set this to NO the error disappeared.

    I sure don't remember ever touching or even knowing about this but luckily now it works.

提交回复
热议问题