0

I'm trying to integrate Firebase (for Dynamic Links) in my current Xcode iOS project but I have problems with errors in the build (Following this documentation: https://firebase.google.com/docs/dynamic-links/ios/receive).

My Podfile looks like this:

# Uncomment the next line...
# platform :ios, '9.0'


target 'AppName1' do
    # Comment the next line if you don't want to use dynamic frameworks

    use_frameworks!


    # Pods for AppName1
    pod 'Firebase/Analytics'
    pod 'Firebase/DynamicLinks'
end


target 'NotificationServiceExtension' do
    # Comment the next line if you don't want to use dynamic frameworks

    use_frameworks!


    # Pods for NotificationServiceExtension
    pod 'Firebase/Analytics'
    pod 'Firebase/DynamicLinks'end


(... With more targets ...)

TEST1. When I try to complile the App target, this is the errors I am getting:

Error1 Image

'FirebaseCore/FirebaseCore.h' file not found
Firebase.h
While building module 'Firebase' imported from */AppDelegate.h:1.1:
In file included from <module-includes>:1:

Could not build module 'Firebase'
AppDelegate.h
In the file included from */ViewControllerLogin.m:9:
In the file included from */ViewControllerLogin.h:10:

TEST2. If I remove the "pod 'Firebase/ ..." lines from the NotificationServiceExtensions I get these errors:

Error2 Image

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

'openURL:' is unavailable: not available on iOS (App Extension)

TEST1. If I comment the "use_frameworks!" with #, I get the first errors again.

TEST2. If I comment everything inside the targets NotificationServiceExtensions I get:

Library not found for -lFirebaseCore

For every test I'm doing "pod deintegrate" and "pod install" again, open the PROJECT-NAME.xcworkspace, clean and build.

I don't know what else to try or what I'm doing wrong... (the integration with android was super easy...)

Thanks.

Marcos
  • 11
  • 1
  • 4

3 Answers3

1

Try this:

target 'AppName1' do
# Comment the next line if you don't want to use dynamic frameworks

use_frameworks!


# Pods for AppName1
pod 'Firebase/Analytics'
pod 'Firebase/DynamicLinks'

target 'NotificationServiceExtension' do
# Comment the next line if you don't want to use dynamic frameworks

use_frameworks!


# Pods for NotificationServiceExtension
pod 'Firebase/Analytics'
pod 'Firebase/DynamicLinks'

  end
end

post_install do |installer|
   installer.pods_project.targets.each do |target|
    puts target.name
 end
end

CocoaPods docs

Kasım Özdemir
  • 5,414
  • 3
  • 18
  • 35
  • It didn't work, I get the Error2 from the question. I suspect it has something to do with the Extensions not working well with Firebase (https://stackoverflow.com/questions/50592585/can-firebaseauth-5-0-x-be-used-in-an-ios-app-extension/50607314#50607314) but I don't know what to do. – Marcos May 11 '20 at 14:06
  • I get the Error2 setting only the targets to NO (require only App-Extension-Safe Api to NO). And if a set everything on the Pod to NO I get a new error: "ld: framework not found Pods_AppName1 clang: error: linker command failed with exit code 1 (use -v to see invocation)". I also tried multiple variations of this with no luck... – Marcos May 11 '20 at 16:54
1

The problem was related to xcode not building the pods target with the app target.

The correct configuration in the pods file was including the "pod 'Firebase/Analytics' pod 'Firebase/DynamicLinks'" only in the target apps and not in the target Extensions (TEST2 in the question).

After executing "pod update" or "pod install" and opening the correct "your-project.xcworkspace" the answer was to go to Build Settings of the Pods parent Target and set the setting "Build Active Architecture Only" to "No" (Every time a pod is updated, this setting returns to "Yes" in Debug mode). With this, the Pod Target gets build alongside the App Target.

Marcos
  • 11
  • 1
  • 4
0

Firebase Dynamic Links is not currently supported in extensions.

File an issue at https://github.com/firebase/firebase-ios-sdk to request for consideration.

Paul Beusterien
  • 27,542
  • 6
  • 83
  • 139