14
votes

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?

5
Did you want to use App Links? If you don't use that, you can try to add pod 'Bolts/Tasks' into your Podfile. It's a subspec. - Bannings
Oh, sounds nice, i'll try! Where did you got info about this? - Franck
I don't have Bolts directly in my pod, it was a dependancy of one of these... source 'github.com/CocoaPods/Specs.git' platform :ios, '7.0' link_with 'MainTarget', 'Widget1001' pod 'GoogleAnalytics', '~> 3.0' pod 'Parse', '~> 1.2' pod 'ParseUI' pod 'ParseFacebookUtilsV4', '~> 1.3' pod 'FMDB', '~> 2.2' pod 'NGAParallaxMotion', '~> 1.0' pod 'EDStarRating', '~> 1.1' pod 'skpsmtpmessage', '~> 0.0' pod 'CZPhotoPickerController', '~> 1.2' pod 'AFNetworking', '~> 2.3' pod 'SVProgressHUD', '~> 1.1' - Franck

5 Answers

3
votes

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.

2
votes

That is a problem related to the settings of Cocoapods projects

You can probably find the answer here

UIApplication.sharedApplication not available

1
votes
0
votes

I've fixed this by downgrading cocoapods to 0.35.2

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

0
votes

For those coming to this because of Xcode 13 Beta 3, you can resolve this error in your app, or open a ticket for the third party dependency causing this issue by marking marking the method explicitly as unavailable.

@available(iOSApplicationExtension, unavailable)