4

so what I am trying to do is get the information of the current user from Firebase and display that on a today widget. In order to do that I had to set the Today extension up like it's own app following this guide. Everything went smoothly; however, when I tried to run the app I got three error messages from a completely different framework that I am using that has absolutely nothing to do with the today extension, it't the Framework IQAudioRecorderController. I get this error in the IQAudioCropperViewController.m file:

"sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead."

I have looked up the reasons for this online and it's because the framework isn't compatible with extensions, but the thing is, this framework has nothing to do with my extension and it could have chosen any of the other frameworks as well, why this one. I've looked online for a solution and nothing is what I want. I haven't done anything to the app besides add the extension to Firebase following those instructions and added the pod and that's is, then all of a sudden I get 3 of the exact same error messages from the same file. I've tried to Clean and Build and nothing has worked. Thank you so much in advance!

Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'ShareExtension' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for ShareExtension!

end

target 'myApp' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

pod 'JSQMessagesViewController', '7.3.3'  
pod 'IDMPhotoBrowser'

pod 'Firebase/Database'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'

pod 'MBProgressHUD'

pod 'IQAudioRecorderController'

pod 'SinchRTC'
pod 'OneSignal'

  # Pods for myApp

  target 'myAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'myAppUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'SiriIntents' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for SiriIntents

end

target 'SiriIntentsUI' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for SiriIntentsUI

end

target 'TodayExtension' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

pod 'Firebase/Database'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'

  # Pods for TodayExtension

end
Guven
  • 2,280
  • 2
  • 20
  • 34
Jaqueline
  • 465
  • 2
  • 8
  • 25

1 Answers1

1

This is caused by the following code inside Firebase pods:

  • [UIApplication sharedApplication]

FIRAuth.m has this code among bunch of other classes. iOS extensions have a slightly different architecture, calling sharedApplication is not something they can do.

It seems as Firebase is not officially supporting extensions in iOS. I have got that info from this GitHub issue. Maybe someone from Firebase can also confirm this here. I am very surprised that we can't use Firebase SDK when creating extensions such as a Today widget.

The only workaround I had was reverting back to an earlier version of Firebase via:

pod 'Firebase', '4.9.0'

This uses the 4.9.0 version of the Firebase SDK and doesn't create compiler errors.

Check the Stackoverflow thread for more details. In summary, a fix is targeted for 5.2.x version that resolves this issue!

Guven
  • 2,280
  • 2
  • 20
  • 34