【问题标题】:Can't import FirebaseMessaging in objective-c AppDelegate.h无法在objective-c AppDelegate.h中导入FirebaseMessaging
【发布时间】:2018-12-19 04:00:36
【问题描述】:

每当我写 @import FirebaseMessaging; 时说 -

找不到模块“FirebaseMessaging”

我做了什么 - 起初我只使用 Firebase/Core 安装 pod,但之后我意识到 Firebase/Messaging 也是必要的. 然后我在 pod 文件中写入 pod 'Firebase/Messaging' 并再次安装 pod。

pod 文件夹包含作为 Firebase Messaging 的文件夹,但是当我导入它时,它说找不到模块。

【问题讨论】:

    标签: ios objective-c firebase push-notification firebase-authentication


    【解决方案1】:

    您不需要在最新的Firebase SDK中根据documentation单独导入FirebaseMessaging

    您需要将 Firebase 初始化代码添加到您的应用程序中。导入 Firebase 模块并配置共享实例,如下所示:

    1. 在您的 UIApplicationDelegate 中导入 Firebase 模块:
    @import Firebase;
    
    1. 配置 FirebaseApp 共享实例,通常在应用程序的 application:didFinishLaunchingWithOptions: 方法中:
    // Use Firebase library to configure APIs
    [FIRApp configure];
    

    【讨论】:

    • 感谢您的帮助。我真的很担心。
    • 另外,虽然不需要,但 @import FirebaseMessaging 将在构建后工作。 Xcode 编辑器在初始构建之前无法识别 CocoaPods 模块。
    猜你喜欢
    • 1970-01-01
    • 2019-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多