Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "'sharedApplication' is unavailable: not available on iOS (App Extension)...." when compiling after pod update

Hi have a projets(including app extension) using cocoapods. (with Parse, Bolts, etc library).

All work fine before (using bolts 1.1.5 library), but, when i've run a pod update (Bolts 1.2.0), I now get some errors:

"/Volumes/project 2/Pods/Bolts/Bolts/iOS/BFAppLinkNavigation.m:100:29: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead."

Any Idea how to solve this?

like image 703
Franck Avatar asked Aug 16 '15 01:08

Franck


3 Answers

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.

like image 127
trojanfoe Avatar answered Oct 08 '22 20:10

trojanfoe


That is a problem related to the settings of Cocoapods projects

You can probably find the answer here

UIApplication.sharedApplication not available

like image 39
Jibeex Avatar answered Oct 08 '22 18:10

Jibeex


Just refer to this, which will help you out:

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

like image 1
Paradise Avatar answered Oct 08 '22 18:10

Paradise