使用模块接口的桥接标头是不支持的。

问题描述 投票:0回答:0
i最近将我的MacOS更新为版本15.3(24D60),然后将Xcode更新为版本16.2。更新后,我开始在项目中遇到以下错误:

使用模块接口的桥接标头是不支持的

当我尝试构建项目时,会发生这种错误,其中包括Swift和Objective-C代码的组合。以前,一切都很好,但是在更新后,构建失败了此错误。 关于我的项目的详细信息:

我的项目是一个包括Swift和Objective-C代码的框架。 I正在使用桥接标头(MyFramework-Bridging-Header.h

)将Objective-C代码暴露于Swift。
    在更新之前,该项目正常运行。
  • 我尝试的是:
    
    
  • I检查了构建设置,并确认设置设置为
Defines Module

我尝试清洁构建文件夹(YES

)并进行重建,但错误仍然存在。
  1. I验证了桥接标头在

    Product > Clean Build Folder
    构建设置中正确引用。

    i用模块地图和伞状标头替换了桥接标头。这是我目前的设置:
  2. umbrella标头(

    Objective-C Bridging Header
    ):

  3. MyFrameworkName.h

    模块地图(

    #import <Foundation/Foundation.h> // Public headers #import "GeneratedPluginRegistrant.h" #import "Flutter.h" #import "FlutterPlugin.h"
  4. ):
  5. module.modulemap

    I卸下了桥接标头,并在构建设置中添加了
    framework module MyFrameworkName { umbrella header "MyFrameworkName.h" export * module * { export * } } 路径。

    设置设置为
    Module Map File
    .

    尽管有这些更改,但我现在遇到一个新错误:

    Defines Module
    • eRROR消息:
      
      
    • 原始错误:
      
      
    使用模块接口的桥接标头是不支持的
  6. 更改后的新错误:

    
    
  7. 在appdelegate上找不到的杂货

问题:
  1. 最初的错误在更新为MacOS 15.3和Xcode 16.2?

    之后会发生原始错误

    使用模块地图和雨伞标头时,我可以如何解决

    YES
    错误?
  2. 有推荐的方法可以在框架中替换桥接标头,同时确保正确集成了颤音依赖性?
  3. additional信息:

    XCODE版本:
  4. 16.2

MACOS版本:15.3(24d60)

  1. 项目类型:
  2. 框架(混合Swift and Objective-C)
  3. Flutter集成:
  4. 项目包括扑动依赖性,我正在使用
  5. flutter not found on AppDelegate

步骤复制:

  • 创建具有混合迅速和目标C代码的框架。 使用桥接标头将Objective-C代码暴露于Swift。 update to macos 15.3和xcode16.2.
  • 用模块地图和雨伞标头重新放置桥接标头。 构建项目。
  • 代码片段:
  • appdelegate.m:
    flutter not found on AppDelegate

构建设置:

  1. GeneratedPluginRegistrant.h
  2. #import <Flutter/Flutter.h> #import "GeneratedPluginRegistrant.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { FlutterViewController *controller = (FlutterViewController *)self.window.rootViewController; [GeneratedPluginRegistrant registerWithRegistry:controller]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end
  3. Defines Module
  4. YES

Module Map File:(空)

任何有关如何解决此问题的帮助或指导将不胜感激!

在更新到

$(SRCROOT)/path/to/module.modulemapObjective-C Bridging Header

    firebase_messaging
  • ^14.6.9
    ^15.0.0
  • firebase_core
  • ,问题就解决了。无需添加模块接口,并且项目成功构建。
    	
swift objective-c xcode bridging-header
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.