Firebase Module install on ios

前端 未结 10 1390
囚心锁ツ
囚心锁ツ 2021-02-18 20:38

I followed all instructions for integrating the new firebase release on ios:

  1. I downloaded the file GoogleService-Info.plist

相关标签:
10条回答
  • 2021-02-18 21:00

    I had the same problem. I found that the problem was I have three targets in Cocoapods file. And only my main one target has Firebase added. So that when I want to import Firebase to a file that is used in other targets, Xcode gives error and says Module 'Firebase' not found. This is my pods project file. One solution for me is adding Firebase pod to all targets. Or another solution is removing the file from other targets.

    def common_pods
      pod 'XXX'
    end
    
    target 'myMainProject' do
      common_pods()
      pod 'Firebase/Core'
      pod 'Firebase/AdMob'
      pod 'Firebase/RemoteConfig'
      pod 'Firebase/Crashlytics'
      pod 'Firebase/Analytics'
    end
    
    target 'myExtention1' do
      common_pods()
    end
    
    target 'myextension2' do
      common_pods()
    end

    0 讨论(0)
  • 2021-02-18 21:00

    There are two ways of adding the Firebase SDK to your iOS project. You can either use CocoaPods, in which case its really important to make sure your pod dependency is in the target you are using. E.g.

    use_frameworks!
    platform :ios, '7.0'
    pod 'Firebase/Analytics'
    
    target 'Target1' do
    end
    target 'Target2' do
    end
    

    There are a lot of different ways of configuring targets in CocoaPods, so your Podfile may look different. The important thing is that the target you specify is linked with the pod - in this case I have specified the Analytics pod so its available to all targets, but if I put it just in the Target1 do...end block, then it wouldn't be available in Target2.

    If you're using the framework integration method, then make sure the libraries are specified in the Link Binary With Libraries section of your Build Phases tab. This should happen automatically if you drag them into a Frameworks group in Xcode.

    Finally, if that doesn't work, Xcode may have cached something bad. Try opening the Product menu, hold down Option and click Clean build folder.

    0 讨论(0)
  • 2021-02-18 21:01

    I tried the above but sadly, nothing worked. Clean the build folder, clearing Xcode cache helped me. Try this:

    1. Quit Xcode.
    2. Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData
    3. Delete ProjectName.xcworkspace
    4. Delete Podfile.lock file and Pods folder
    5. Run pod install.
    6. Open the newly created ProjectName.xcworkspace file and build.

    Pay extensive attention to the 6th step. Open this newly created xcworkspace, not xcodeproj.

    Original answer: https://stackoverflow.com/a/44486792/913601

    0 讨论(0)
  • 2021-02-18 21:06

    update your pods. open terminal go to your project directory and type the following command

    pod update

    0 讨论(0)
  • 2021-02-18 21:08

    Its work for me in this way.

    using FirebaseCore/FirebaseCore.h

    Try the below code.

    #import "AppDelegate.h"
    #import <FirebaseCore/FirebaseCore.h>
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        [FIRApp configure];
        return YES;
    }
    
    0 讨论(0)
  • 2021-02-18 21:13

    Got the same issue on the import. My target's build settings overrode the 'Header search path' without the '$(inherited)' flag

    'pod update' warns you about that.

    1. Open your target build settings
      target build settings
    1. In 'Header search paths' add a line containing $(inherited).

    It solved the issue for me

    Hope it helps

    0 讨论(0)
提交回复
热议问题