Open yairsts opened 6 months ago
It sounds like you might be linking both sqlite3 and sqlcipher, for instance because another Flutter plugin or native dependency needs sqlite. Did you try adding this to your podspec?
Yes, this is my Podfile:
platform :ios, '11.0'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
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!
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 |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.sub(' -l"sqlite3"', '')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
this is my OTHER_LDFLAGS:
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-l\"c++\"",
"-l\"z\"",
"-framework",
"\"AVFoundation\"",
"-framework",
"\"Accelerate\"",
"-framework",
"\"CoreData\"",
"-framework",
"\"CoreGraphics\"",
"-framework",
"\"CoreImage\"",
"-framework",
"\"CoreLocation\"",
"-framework",
"\"CoreTelephony\"",
"-framework",
"\"CoreText\"",
"-framework",
"\"FBLPromises\"",
"-framework",
"\"FirebaseABTesting\"",
"-framework",
"\"FirebaseAnalytics\"",
"-framework",
"\"FirebaseCore\"",
"-framework",
"\"FirebaseCoreExtension\"",
"-framework",
"\"FirebaseCoreInternal\"",
"-framework",
"\"FirebaseCrashlytics\"",
"-framework",
"\"FirebaseDynamicLinks\"",
"-framework",
"\"FirebaseInstallations\"",
"-framework",
"\"FirebaseMessaging\"",
"-framework",
"\"FirebaseRemoteConfig\"",
"-framework",
"\"FirebaseSessions\"",
"-framework",
"\"FirebaseSharedSwift\"",
"-framework",
"\"Foundation\"",
"-framework",
"\"GLKit\"",
"-framework",
"\"GoogleAppMeasurement\"",
"-framework",
"\"GoogleAppMeasurementIdentitySupport\"",
"-framework",
"\"GoogleDataTransport\"",
"-framework",
"\"GoogleMaps\"",
"-framework",
"\"GoogleMapsBase\"",
"-framework",
"\"GoogleMapsCore\"",
"-framework",
"\"GoogleUtilities\"",
"-framework",
"\"IOSSecuritySuite\"",
"-framework",
"\"ImageIO\"",
"-framework",
"\"IosAwnCore\"",
"-framework",
"\"MTBBarcodeScanner\"",
"-framework",
"\"Metal\"",
"-framework",
"\"OpenGLES\"",
"-framework",
"\"Promises\"",
"-framework",
"\"QuartzCore\"",
"-framework",
"\"Security\"",
"-framework",
"\"StoreKit\"",
"-framework",
"\"SystemConfiguration\"",
"-framework",
"\"UIKit\"",
"-framework",
"\"awesome_notifications\"",
"-framework",
"\"awesome_notifications_core\"",
"-framework",
"\"device_info\"",
"-framework",
"\"device_info_plus\"",
"-framework",
"\"firebase_analytics\"",
"-framework",
"\"firebase_core\"",
"-framework",
"\"firebase_crashlytics\"",
"-framework",
"\"firebase_dynamic_links\"",
"-framework",
"\"firebase_messaging\"",
"-framework",
"\"firebase_remote_config\"",
"-framework",
"\"flutter_jailbreak_detection\"",
"-framework",
"\"flutter_native_splash\"",
"-framework",
"\"flutter_secure_storage\"",
"-framework",
"\"google_maps_flutter_ios\"",
"-framework",
"\"location\"",
"-framework",
"\"map_launcher\"",
"-framework",
"\"nanopb\"",
"-framework",
"\"open_filex\"",
"-framework",
"\"package_info_plus\"",
"-framework",
"\"path_provider_foundation\"",
"-framework",
"\"permission_handler_apple\"",
"-framework",
"\"qr_code_scanner\"",
"-framework",
"\"share_plus\"",
"-framework",
"\"shared_preferences_foundation\"",
"-framework",
"\"sms_autofill\"",
"-framework",
"\"sqlite3\"",
"-framework",
"\"sqlite3_flutter_libs\"",
"-framework",
"\"url_launcher_ios\"",
"-framework",
"\"vibration\"",
"-framework",
"\"webview_flutter_wkwebview\"",
"-weak_framework",
"\"LinkPresentation\"",
"-weak_framework",
"\"UserNotifications\"",
"-weak_framework",
"\"WebKit\"",
"-framework",
SQLCipher,
);
Still i get this error.
Do you have a dependency on both sqlite3_flutter_libs
and sqlcipher_flutter_libs
? -framework sqlite3
and -framework sqlite3_flutter_libs
should not appear in that list if you want to use SQLCipher.
No, I removed sqlite3_flutter_libs
. -framework sqlite3_flutter_libs
left, I remove it now and unfortunately, I still get the error
Of course, I delete all Pods folder and podfile.lock and run Pod install
having the same issue here. thought it was an issue due to flutter version upgrade. but downgraded it again, still the same issue.
but for me I have the following dependencies:
Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_file'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:728:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_io_methods'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:834:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_vfs'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:1464:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_mem_methods'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:1764:7
Swift Compiler Error (Xcode): Conflicting types for 'sqlite3_create_filename'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:3919:28
Swift Compiler Error (Xcode): Conflicting types for 'sqlite3_free_filename'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:3926:16
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_module'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7183:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_index_info'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7323:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_index_constraint'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7326:9
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_index_orderby'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7333:9
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_index_constraint_usage'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7338:9
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_vtab'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7501:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_vtab_cursor'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:7525:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_mutex_methods'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:8020:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_pcache_page'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:8790:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_pcache_methods2'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:8955:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_pcache_methods'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:8978:7
Swift Compiler Error (Xcode): Redefinition of 'sqlite3_snapshot'
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:10352:15
Swift Compiler Error (Xcode): Typedef redefinition with different types ('struct (unnamed struct at /Users/robin/IdeaProjects/app/app/build/ios/Debug-iphoneos/sqlite3/sqlite3.framework/Headers/sqlite3.h:10353:16)' vs 'struct sqlite3_snapshot')
/Users/robin/IdeaProjects/app/app/ios/Pods/sqlite3/sqlite-src-3430100/sqlite3.h:10354:2
Swift Compiler Error (Xcode): Could not build Objective-C module 'SQLite3'
It sounds like you might be linking both sqlite3 and sqlcipher, for instance because another Flutter plugin or native dependency needs sqlite. Did you try adding this to your podspec?
It also doesn't work with this fix suggestion.
I have the same problem. there should be a fix for this
writing this comment if you have the same problem as me and are desperate for a fix, maybe this works for you.
If you are using drift database package and using sqlite3_flutter_libs
package only to making sqlite3 database to work on Android. maybe you can fork the repo and delete the iOS side of the plugin. that way iOS compiles successfully and Android app works as well.
here is my fork if you need it.
https://github.com/easazade/sqlite3.dart/tree/remove-ios
I use
sqlcipher_flutter_libs: 0.6.0
, in Android everthing works properly, but in iOS I got some errors.Help please 🙏🏼