2

Error

it shows this error message when running flutter on IOS 14

Swift Compiler Error (Xcode): Include of non-modular header inside framework module 'FirebaseSessions.FIRSESNanoPBHelpers':
           '/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/Headers/Public/nanopb/pb.h'

/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/FirebaseSessions/FirebaseSessions/SourcesObjC/NanoPB/FIRSE
           SNanoPBHelpers.h:28:8
           
[   +4 ms] Swift Compiler Error (Xcode): Include of non-modular header inside framework module 'FirebaseSessions.FIRSESNanoPBHelpers':
           '/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/Headers/Public/nanopb/pb_decode.h'

/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/FirebaseSessions/FirebaseSessions/SourcesObjC/NanoPB/FIRSE
           SNanoPBHelpers.h:29:8
           
[        ] Swift Compiler Error (Xcode): Include of non-modular header inside framework module 'FirebaseSessions.FIRSESNanoPBHelpers':
           '/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/Headers/Public/nanopb/pb_encode.h'

/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/FirebaseSessions/FirebaseSessions/SourcesObjC/NanoPB/FIRSE
           SNanoPBHelpers.h:30:8
           
[        ] Swift Compiler Error (Xcode): Include of non-modular header inside framework module 'FirebaseSessions.sessions_nanopb':
           '/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/Headers/Public/nanopb/pb.h'

/Users/azzura/Documents/Projects/Self-Learn/flutter-dev/flutter_financial/ios/Pods/FirebaseSessions/FirebaseSessions/SourcesObjC/Protogen/nan
           opb/sessions.nanopb.h:21:9
           
[        ] Swift Compiler Error (Xcode): Could not build Objective-C module 'FirebaseSessions'
           
[   +3 ms] Could not build the application for the simulator.
[   +1 ms] Error launching application on iPhone 14 Pro Max.

Podfile

here's my podfile should i change how i put pod 'Firebase'?

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
$RNFirebaseAsStaticFramework = true

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  pod 'BoringSSL-GRPC'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |build_configuration|
      build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end

i tried Deleting pubspec.lock, Pods folder in ios and Podfile.lock then running flutter clean -> flutter pub get -> cd ios -> pod install -> cd .. -> flutter run, but it still won't work

Koya
  • 31
  • 4

3 Answers3

0

Recent versions of Firebase require use_frameworks! (or use_frameworks! :linkage => :static in the Podfile. use_modular_headers! is no longer supported.

Paul Beusterien
  • 27,542
  • 6
  • 83
  • 139
0

Made the above changes as suggest by Paul, in the pod file changed use_frameworks! to use_frameworks! :linkage => :static and commented out use_modular_headers! but still facing same error.

Update like this in the pod file

target 'Runner' do
  use_frameworks! :linkage => :static

Any updated solution on this?

0

Found this but not able to understand where and how to implement it.

https://github.com/invertase/firestore-ios-sdk-frameworks/issues/59

Tried implementing it under

ios > Pods > Local Podspecs > FirebaseFirestore.podspec.json

but in the reference link above the file is not json and i tried to make the changes in json format but everytime when I run build the changes disappear.

Would appreciate the help on this.