0

I am using CocoaPods v1.16.2 and Xcode 16.3.

I have a native iOS app in which a few screens need to be built using flutter. For that, I have integrated Flutter into the iOS project using CocoaPods by referring to this.

Flutter frameworks are added as development pods.

When I am trying to build the iOS project, one of the development pods, called FlutterPluginRegistrant, fails to build with the error:

/Users/me/Documents/repos/ios-bingo-international/Pods/Headers/Private/sqflite_darwin/SqflitePlugin.h:10:9:'include/sqflite_darwin/SqflitePluginPublic.h' file not found

While there are a total of 3 includes in the FlutterPluginRegistrant header file that is just below, the other two, except SqflitePlugin.h, have no issues in linking.

#import "GeneratedPluginRegistrant.h"

#if __has_include(<connectivity_plus/ConnectivityPlusPlugin.h>)
#import <connectivity_plus/ConnectivityPlusPlugin.h>
#else
@import connectivity_plus;
#endif

#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
#import <path_provider_foundation/PathProviderPlugin.h>
#else
@import path_provider_foundation;
#endif

#if __has_include(<sqflite_darwin/SqflitePlugin.h>)
#import <sqflite_darwin/SqflitePlugin.h>
#else
@import sqflite_darwin;
#endif


@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
  [ConnectivityPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"ConnectivityPlusPlugin"]];
  [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
  [SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
}


/*
 
 If I comment out the include statement and usage, lines 21 to 25 and line 33, then the FlutterPluginRegistrant development pod successfully builds.
 */

@end

The actual issue lies in SqflitePlugin.h, where it tries to import #import "include/sqflite_darwin/SqflitePluginPublic.h" and fails to find it.

If I replace #import "include/sqflite_darwin/SqflitePluginPublic.h" with #import "SqflitePluginPublic.h" issue gets resolved.

But I must not edit these dependency pods' source code.

I tried cleaning Flutter, installing pods again, but nothing worked.

I have attached screenshots for better understanding.

Any suggestion to fix this?

//
//  SqflitePlugin.h
//  sqflite
//
//  Created by Alexandre Roux on 24/10/2022.
//
#ifndef SqflitePlugin_h
#define SqflitePlugin_h

//this import causes error
#import "include/sqflite_darwin/SqflitePluginPublic.h"

extern NSString *const SqfliteMethodExecute;;
extern NSString *const SqfliteMethodInsert;
extern NSString *const SqfliteMethodUpdate;
extern NSString *const SqfliteMethodQuery;

extern NSString *const SqfliteErrorBadParam;
extern NSString *const SqliteErrorCode;

extern NSString *const SqfliteParamMethod;
extern NSString *const SqfliteParamSql;
extern NSString *const SqfliteParamSqlArguments;
extern NSString *const SqfliteParamInTransactionChange;
extern NSString *const SqfliteParamNoResult;
extern NSString *const SqfliteParamContinueOnError;
extern NSString *const SqfliteParamResult;
extern NSString *const SqfliteParamError;
extern NSString *const SqfliteParamErrorCode;
extern NSString *const SqfliteParamErrorMessage;
extern NSString *const SqfliteParamErrorData;
extern NSString *const SqfliteParamTransactionId;

// Static helpers
static const int sqfliteLogLevelNone = 0;
static const int sqfliteLogLevelSql = 1;
static const int sqfliteLogLevelVerbose = 2;

extern bool sqfliteHasSqlLogLevel(int logLevel);
// True for verbose debugging
extern bool sqfliteHasVerboseLogLevel(int logLevel);

#endif // SqflitePlugin_h

enter image description here

1 Answer 1

-1

The GeneratedPluginRegistrant.h file works fine on Apple Silicon (M1, M2, M3, etc.) Macs, but it causes issues on Intel-based Macs.
I found a solution: if you remove the sqflite_darwin code, it will work. Please check the updated GeneratedPluginRegistrant.h file for your reference.

#import "GeneratedPluginRegistrant.h"

#if __has_include(<connectivity_plus/ConnectivityPlusPlugin.h>)
#import <connectivity_plus/ConnectivityPlusPlugin.h>
#else
@import connectivity_plus;
#endif

#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
#import <path_provider_foundation/PathProviderPlugin.h>
#else
@import path_provider_foundation;
#endif


@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
  [ConnectivityPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"ConnectivityPlusPlugin"]];
  [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
 
}


/*
 
 If I comment out the include statement and usage, lines 21 to 25 and line 33, then the FlutterPluginRegistrant development pod successfully builds.
 */

@end

Sign up to request clarification or add additional context in comments.

3 Comments

I am running it on Apple Silicon. Removing the dependency is not the solution, athough I mentioned the same in my question to prove that other dependecies are being imported without any issues. Please read the very last comment in file GeneratedPluginRegistrant.h in your answer.
@devgr Please add below configuration in podfile post_install do |installer| flutter_post_install(installer) if defined?(flutter_post_install) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" end end end
Then run pod install command and after that clear Derive Data and then clean build and run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.