The error "'sharedApplication' is not available: not available on iOS (application extension) ...." when compiling after updating pod

Hi, I have projects (including an app extension) using cocoapods. (using Parse, Bolts, etc.).

Everything works fine before (using the library bolts 1.1.5), but when I started the module update (Bolts 1.2.0), now I get some errors:

"/ Volumes / project 2 / Substrates / Bolts / Bolts / iOS / BFAppLinkNavigation.m: 100: 29:" sharedApplication "is not available: is not available in iOS (application extension). Use views based controller solutions instead."

Any idea how to solve this?

+10
ios xcode bolts-framework
source share
5 answers

Cocoapods are very useful (I'm sure), but they are designed to work with applications, not application extensions, and, ultimately, you lose control over the functions that they implement during the update, so you will need to judge more about which versions of libraries you use, based on the APIs it uses.

In the case of Bolts 1.2.0, he decided to use sharedApplication , which makes it unsuitable for use in the application extension.

So, you will need to start using the libraries in their original form, perhaps using the git submodule for each of them, which will allow you to update them when updating the upstream.

+2
source share

This is a Cocoapods project settings issue.

You can find the answer here.

Not Available UIApplication.sharedApplication

+2
source share
+1
source share

I fixed this by lowering the capacodes to 0.35.2

If you have a cleaner solution, I'm open!

0
source share

Some APIs are not available for application extensions.

Using the built-in code sharing platform

Make sure your embedded environment does not contain APIs that are not available for application extensions, as described in Some APIs are not available for application extensions. If you have a user environment that contains such APIs, you can safely reference it from your application, but you cannot share this code with applications that contain extensions. The application store rejects any application extension that refers to such platforms or uses otherwise inaccessible APIs.

Only the AppExtension-Safe API is required. Everything is set to YES. By default it is NO. When setting NO, the error disappeared.

Goal โ†’ Build Settings โ†’ Only AppExtension-Safe API Required โ†’ NO

0
source share

All Articles