flutterxcodeipafmdbsqlcipher

I have a problem with sqlcipher.bundle (Multiple commands produce) in my flutter iOS app


So I have a flutter app and when I debug it on my iPhone it works perfectly but when I try to build an ipa file it shows me this error:

Which indicates that there are multiple commands which are trying to produce the SQLCipher.bundle folder in the same place with the same name. and those two which are attempting that are FMDB and SQLCipher. They are both generated because I'm using sqflite_sqlcipher: ^3.1.0+1 in my flutter app.

Showing Recent Issues Multiple commands produce '/Users/user1/Library/Developer/Xcode/DerivedData/Runner-bgmcokivomqkibdepnikxaoitzbu/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'

Showing Recent Issues Target 'FMDB-SQLCipher' (project 'Pods') has create directory command with output '/Users/user1/Library/Developer/Xcode/DerivedData/Runner-bgmcokivomqkibdepnikxaoitzbu/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'

Showing Recent Issues Target 'SQLCipher-SQLCipher' (project 'Pods') has create directory command with output '/Users/user1/Library/Developer/Xcode/DerivedData/Runner-bgmcokivomqkibdepnikxaoitzbu/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'

and I have tried everything from flutter clean, pub get and upgrade to pod deintegrate and pod install any many more solutions like editing the podfile but unfortunately nothing worked.

Because the both FMDB and SQLCipher are automatically generated when pod install is committed then any changes in podfile.lock would be hopeless.

if anyone has a solution please help.


Solution

  • I came across a useful workaround for this issue on the package's GitHub page. You can add the following code to your Podfile to resolve it:

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        if target.name == 'FMDB-SQLCipher'
          target.build_configurations.each do |config|
            config.build_settings['PRODUCT_NAME'] = 'FMDBSQLCipher'
          end
        end
        flutter_additional_ios_build_settings(target)
      end
    end
    

    This code snippet changes the PRODUCT_NAME for the FMDB-SQLCipher target and applies additional Flutter build settings for iOS. For more details, check out the discussion on the package's GitHub issue page.