1

I'm attempting to build an app on iOS using Flutter. The app builds and runs fine on Android however the app is refusing to build on iOS. To build the app I'm using the command flutter build ios

This is the error I receive when trying to build:

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.

From what I can tell the main issue is coming from the error:

include of non-modular header inside framework module

I attempted to turn Allow Non-Modular Includes In Framework Modules to YES as recommended in this solution but that did not change anything. This thread offered a solution that involved going to Framework -> Target -> Build Phases -> Headers. However my project has no such location.

I'm very new to using Xcode and building iOS apps so any help would be appreciated.

EDIT: After more research I saw some similar errors solved by replacing <> with "" at the end of the import such that the import looks like this:

#import "FBSDKCoreKit/FBSDKAccessToken.h"

This did not get rid of the error but I thought I should include it here in case someone recommends this solution.

OnlyASeth
  • 31
  • 1
  • 5

1 Answers1

1

You're on the right track. A "non-modular" header is basically a private header. The error is complaining that such a header is being imported (possibly recursively) by a public header, essentially making the private header public. This is usually an accident or a sign of bad software design, so recent Xcode versions have turned this into an error.

Since you are getting this error in a 3rd party library, your options are

  • get an updated version of that library which fixes the error
  • downgrade to an older version of Xcode which does not treat that as an error (Xcode 11.7)
  • find a way to disable the error in Xcode. If you can somehow access the build settings of the Facebook SDK, you need to set "Allow Non-Modular Includes In Framework Modules" in there, not in your app's settings
Max
  • 21,123
  • 5
  • 49
  • 71
  • 1
    Thank you for your suggestions. I made sure that the FBSDK was the most recent version. Also, I tried disabling the error by setting the "Allow Non-Modular Includes In Framework Modules" to "YES" but I received the same error. Are there any other suggestions you can think of? – OnlyASeth Jul 13 '21 at 22:21