Firebase Module install on ios

2020-07-01 08:39发布

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

  1. I downloaded the file GoogleService-Info.plist and include it in the project.

  2. I installed the framework with cocoapods

The problem is with this line:

@import Firebase;

Xcode prints this error:

"Module Firebase not found"

What is the solution?

My code :

#import "AppDelegate.h"

@import Firebase

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [FIRApp configure];

    // Override point for customization after application launch.
    return YES;
}

标签: ios firebase
10条回答
疯言疯语
2楼-- · 2020-07-01 09:20

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

查看更多
我命由我不由天
3楼-- · 2020-07-01 09:20

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

pod update

查看更多
劫难
4楼-- · 2020-07-01 09:23

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.

查看更多
混吃等死
5楼-- · 2020-07-01 09:23

I had similar issue stating that FirebaseMessaging module not found in header even though I had correct Podfile configuration.

Screenshot 1

Solution is to remove Cocoapods from project and add it again.

You can remove CocoaPods from project using this link.

Thereafter, you can add CocoaPods again using this link.

Below is snapshot for Podfile that I have used.

Screenshot 2

Below snapshot shows log on dependencies that are installed using Pods.

Screenshot 3

查看更多
登录 后发表回答