我正在尝试使用 Flutter 在 iOS 上构建一个应用程序。该应用程序在 Android 上构建并运行良好,但该应用程序拒绝在 iOS 上构建。为了构建应用程序,我使用命令
flutter build ios
Xcode's output:
↳
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/FBSDKLoginKit-framework-umbrella.h"
^
/Users/MyUsername/Dev/MyApp/ios/Pods/Target Support
Files/FBSDKLoginKit-framework/FBSDKLoginKit-framework-umbrella.h:13:9: note: in file included from
/Users/MyUsername/Dev/MyApp/ios/Pods/Target Support
Files/FBSDKLoginKit-framework/FBSDKLoginKit-framework-umbrella.h:13:
#import "FBSDKCoreKitImport.h"
^
/Users/MyUsername/Dev/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKCoreKitImport.h:29:1
0: error: include of non-modular header inside framework module 'FBSDKLoginKit.FBSDKCoreKitImport':
'/Users/MyUsername/Dev/MyApp/ios/Pods/Headers/Public/FBSDKCoreKit/FBSDKCoreKit.h'
#import "FBSDKCoreKit/FBSDKCoreKit.h"
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/FBSDKLoginKit-framework-umbrella.h"
^
/Users/MyUsername/Dev/MyApp/ios/Pods/Target Support
Files/FBSDKLoginKit-framework/FBSDKLoginKit-framework-umbrella.h:15:9: note: in file included from
/Users/MyUsername/Dev/MyApp/ios/Pods/Target Support
Files/FBSDKLoginKit-framework/FBSDKLoginKit-framework-umbrella.h:15:
#import "FBSDKDeviceLoginManager.h"
^
/Users/MyUsername/Dev/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKDeviceLoginManager.h
:22:9: note: in file included from
/Users/MyUsername/Dev/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKDeviceLoginManager.h
:22:
#import "FBSDKDeviceLoginManagerResult.h"
^
/Users/MyUsername/Dev/MyApp/ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKDeviceLoginManagerRe
sult.h:22:9: error: include of non-modular header inside framework module
'FBSDKLoginKit.FBSDKDeviceLoginManagerResult':
'/Users/MyUsername/Dev/MyApp/ios/Pods/Headers/Public/FBSDKCoreKit/FBSDKAccessToken.h'
#import <FBSDKCoreKit/FBSDKAccessToken.h>
^
<unknown>:0: error: could not build Objective-C module 'FBSDKLoginKit'
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Encountered error while building for device.
据我所知,主要问题来自错误:
include of non-modular header inside framework module
我尝试按照
此解决方案中的建议将
Allow Non-Modular Includes In Framework Modules
转为YES
,但这并没有改变任何内容。 这个线程提供了一个解决方案,涉及到框架 - >目标 - >构建阶段 - >标题。然而我的项目没有这样的位置。
我对使用 Xcode 和构建 iOS 应用程序非常陌生,因此我们将不胜感激。
编辑:经过更多研究,我看到了一些类似的错误,通过在导入末尾用“”替换<>来解决,这样导入看起来像这样:
#import "FBSDKCoreKit/FBSDKAccessToken.h"
这并没有消除错误,但我认为我应该将其包含在此处,以防有人推荐此解决方案。
您走在正确的道路上。 “非模块化”标头基本上是私有标头。该错误抱怨这样的标头正在由公共标头导入(可能递归地),本质上使私有标头公开。这通常是一次意外或软件设计不良的迹象,因此最近的 Xcode 版本已将其变成错误。
由于您在第三方库中遇到此错误,您的选择是