Error “'sharedApplication' is unavailable: not available on iOS (App Extension)…” when compiling after pod update

北战南征 提交于 2019-11-29 13:22:22

Cocoapods are very useful (I'm sure), however they are designed to work with Apps, not App Extensions, and ultimately you lose control of the features they introduce during an update, so you will need to be more judicial about what versions of libraries you do use, based on the APIs they utilize.

In the case of Bolts 1.2.0, it's obviously decided to use sharedApplication, thus making it unsuitable for use in an App Extension.

So you will need to start using the libraries in source form, perhaps using git submodule for each one, that will allow you to update them when upstream is updated.

Jibeex

That is a problem related to the settings of Cocoapods projects

You can probably find the answer here

UIApplication.sharedApplication not available

Just refer to this, which will help you out:

https://github.com/AFNetworking/AFNetworking/issues/2119

I've fixed this by downgrading cocoapods to 0.35.2

If you have a more clean solution, i'm open!

Some APIs Are Unavailable to App Extensions

Using an Embedded Framework to Share Code

Make sure your embedded framework does not contain APIs unavailable to app extensions, as described in Some APIs Are Unavailable to App Extensions. If you have a custom framework that does contain such APIs, you can safely link to it from your containing app but cannot share that code with the app’s contained extensions. The App Store rejects any app extension that links to such frameworks or that otherwise uses unavailable APIs.

Require Only AppExtension-Safe API. All set to YES. The default though is NO. When setting this to NO the error disappeared.

Target -> Build Settings -> Require Only AppExtension-Safe API -> NO

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!